add logger for RetailAppMessage sender api

master
yixian 5 years ago
parent 9c68bd9f8f
commit 850090b0be

@ -5,12 +5,12 @@
<parent>
<groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId>
<version>1.1.4</version>
<version>1.1.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.2.45</version>
<version>1.2.46</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -6,6 +6,7 @@ import au.com.royalpay.payment.tools.device.message.AppMessage;
import au.com.royalpay.payment.tools.env.RequestEnvironment;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import java.util.Date;
@ -47,7 +48,7 @@ public class RetailAppMessage {
}
public RetailAppMessage setTitle(String title) {
this.title = title;
this.title = StringUtils.substring(title, 0, 50);
return this;
}
@ -56,7 +57,7 @@ public class RetailAppMessage {
}
public RetailAppMessage setBody(String body) {
this.body = body;
this.body = StringUtils.substring(body, 0, 500);
return this;
}

@ -2455,6 +2455,7 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public JSONObject postAppMessage(JSONObject device, RetailAppMessage message) {
logger.debug("post message called by device:{}", device.toJSONString());
String clientType = device.getString("client_type");
if (!GatewayOAuthRegister.CLIENT_TYPE.equals(clientType)) {
throw new ForbiddenException("Invalid Client Type:" + clientType);

@ -7,6 +7,8 @@ import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
@ -19,6 +21,7 @@ import java.time.Duration;
*/
@Service
public class GatewayOAuthRegister implements DeviceRegister {
private Logger logger = LoggerFactory.getLogger(getClass());
public static final String CLIENT_TYPE = "oauthclient";
private MerchantInfoProvider provider;
private AuthHistoryMapper authHistoryMapper;
@ -60,7 +63,7 @@ public class GatewayOAuthRegister implements DeviceRegister {
JSONObject client = provider.getClientInfo(clientId);
auth.put("client_moniker", client.getString("client_moniker"));
auth.put("client", client);
logger.debug("dev info:{}", auth.toJSONString());
return auth;
}

Loading…
Cancel
Save