add logger for RetailAppMessage sender api

master
yixian 6 years ago
parent 9c68bd9f8f
commit 850090b0be

@ -5,12 +5,12 @@
<parent> <parent>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId> <artifactId>payment-parent</artifactId>
<version>1.1.4</version> <version>1.1.5</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>1.2.45</version> <version>1.2.46</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <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.env.RequestEnvironment;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import java.util.Date; import java.util.Date;
@ -47,7 +48,7 @@ public class RetailAppMessage {
} }
public RetailAppMessage setTitle(String title) { public RetailAppMessage setTitle(String title) {
this.title = title; this.title = StringUtils.substring(title, 0, 50);
return this; return this;
} }
@ -56,7 +57,7 @@ public class RetailAppMessage {
} }
public RetailAppMessage setBody(String body) { public RetailAppMessage setBody(String body) {
this.body = body; this.body = StringUtils.substring(body, 0, 500);
return this; return this;
} }

@ -2455,6 +2455,7 @@ public class RetailAppServiceImp implements RetailAppService {
@Override @Override
public JSONObject postAppMessage(JSONObject device, RetailAppMessage message) { public JSONObject postAppMessage(JSONObject device, RetailAppMessage message) {
logger.debug("post message called by device:{}", device.toJSONString());
String clientType = device.getString("client_type"); String clientType = device.getString("client_type");
if (!GatewayOAuthRegister.CLIENT_TYPE.equals(clientType)) { if (!GatewayOAuthRegister.CLIENT_TYPE.equals(clientType)) {
throw new ForbiddenException("Invalid Client Type:" + 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 au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -19,6 +21,7 @@ import java.time.Duration;
*/ */
@Service @Service
public class GatewayOAuthRegister implements DeviceRegister { public class GatewayOAuthRegister implements DeviceRegister {
private Logger logger = LoggerFactory.getLogger(getClass());
public static final String CLIENT_TYPE = "oauthclient"; public static final String CLIENT_TYPE = "oauthclient";
private MerchantInfoProvider provider; private MerchantInfoProvider provider;
private AuthHistoryMapper authHistoryMapper; private AuthHistoryMapper authHistoryMapper;
@ -60,7 +63,7 @@ public class GatewayOAuthRegister implements DeviceRegister {
JSONObject client = provider.getClientInfo(clientId); JSONObject client = provider.getClientInfo(clientId);
auth.put("client_moniker", client.getString("client_moniker")); auth.put("client_moniker", client.getString("client_moniker"));
auth.put("client", client); auth.put("client", client);
logger.debug("dev info:{}", auth.toJSONString());
return auth; return auth;
} }

Loading…
Cancel
Save