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