fix GatewayService

This commit is contained in:
etreschenkov 2024-10-07 09:27:55 +03:00
parent 57f8f32730
commit de49489f0a

View file

@ -289,8 +289,9 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
String clearingSystem = StringUtils.isNotEmpty(gatewayApiSettings.getClearingSystem()) ?
gatewayApiSettings.getClearingSystem() : "SPVB";
request.setClearingSystem(clearingSystem);
if (inboundServerSettings.getAllowedTypes().isEmpty() ||
inboundServerSettings.getAllowedTypes().contains(request.getType())) {
if (inboundServerSettings != null &&
(inboundServerSettings.getAllowedTypes().isEmpty() ||
inboundServerSettings.getAllowedTypes().contains(request.getType()))) {
String url = formingInboundUrl(inboundServerSettings.getEnableSsl(),
inboundServerSettings.getHost(),
inboundServerSettings.getPort(),
@ -298,8 +299,9 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
exchange(request, url);
}
if (inboundExternalServerSettings.getAllowedTypes().isEmpty() ||
inboundExternalServerSettings.getAllowedTypes().contains(request.getType())) {
if (inboundExternalServerSettings != null &&
(inboundExternalServerSettings.getAllowedTypes().isEmpty() ||
inboundExternalServerSettings.getAllowedTypes().contains(request.getType()))) {
String url = formingInboundUrl(inboundExternalServerSettings.getEnableSsl(),
inboundExternalServerSettings.getHost(),
inboundExternalServerSettings.getPort(),
@ -308,7 +310,7 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
}
}
private void exchange(OutboundRequest request, String url){
private void exchange(OutboundRequest request, String url) {
HttpEntity<OutboundRequest> r = makeDefaultRequest(request);
ResponseEntity<SuccessResponse> response = restTemplate.exchange(url, HttpMethod.POST, r, SuccessResponse.class);
SuccessResponse bodyResponse = response.getBody();