From 1e4949902c7c98c1c0fc54d50b918d06e6487e5e Mon Sep 17 00:00:00 2001 From: Anatoly Cherkasov Date: Thu, 12 Jan 2017 19:24:14 +0300 Subject: [PATCH] PROX-39: fix term url (#5) * PROX-39: fix term url * PROX-39: update properties * PROX-39: update pom version --- pom.xml | 2 +- .../mocketbank/controller/MocketBankController.java | 10 +++++----- .../mocketbank/handler/MocketBankServerHandler.java | 2 +- src/main/resources/application.yml | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 684afcf..7f46e38 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ proxy-mocketbank - 1.0.2 + 1.0.3 jar proxy-mocketbank diff --git a/src/main/java/com/rbkmoney/proxy/mocketbank/controller/MocketBankController.java b/src/main/java/com/rbkmoney/proxy/mocketbank/controller/MocketBankController.java index b3e9e24..fdf5491 100644 --- a/src/main/java/com/rbkmoney/proxy/mocketbank/controller/MocketBankController.java +++ b/src/main/java/com/rbkmoney/proxy/mocketbank/controller/MocketBankController.java @@ -6,6 +6,7 @@ import org.apache.thrift.TException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -15,7 +16,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; -import java.util.Optional; @RestController @RequestMapping(value = "/mocketbank") @@ -38,13 +38,13 @@ public class MocketBankController { try { callback = Converter.mapToByteBuffer(Converter.mapArrayToMap(request.getParameterMap())); } catch (IOException e) { - LOGGER.error("Exception Map to ByteBuffer in processCallback", e); + LOGGER.warn("Exception Map to ByteBuffer in processCallback", e); } - if (Optional.ofNullable(request.getParameter("MD")).isPresent()) { + if (StringUtils.hasText(request.getParameter("MD"))) { tag = request.getParameter("MD"); } else { - LOGGER.error("Missing a required parameter 'MD' "); + LOGGER.warn("Missing a required parameter 'MD' "); } try { @@ -54,7 +54,7 @@ public class MocketBankController { LOGGER.error("Exception in processCallback", e); } - if (!request.getParameter("termination_uri").isEmpty()) + if (StringUtils.hasText(request.getParameter("termination_uri"))) servletResponse.sendRedirect(request.getParameter("termination_uri")); return resp; diff --git a/src/main/java/com/rbkmoney/proxy/mocketbank/handler/MocketBankServerHandler.java b/src/main/java/com/rbkmoney/proxy/mocketbank/handler/MocketBankServerHandler.java index 006fdac..29361b1 100644 --- a/src/main/java/com/rbkmoney/proxy/mocketbank/handler/MocketBankServerHandler.java +++ b/src/main/java/com/rbkmoney/proxy/mocketbank/handler/MocketBankServerHandler.java @@ -173,7 +173,7 @@ public class MocketBankServerHandler implements ProviderProxySrv.Iface { Map params = new HashMap<>(); params.put("PaReq", verifyEnrollmentResponse.getPaReq()); params.put("MD", tag); - params.put("TermUrl", MocketBankMpiUtils.getCallbackUrl(callbackUrl, "/test/term_url{?termination_uri}")); + params.put("TermUrl", MocketBankMpiUtils.getCallbackUrl(callbackUrl, "/mocketbank/term_url{?termination_uri}")); LOGGER.info("Processed: prepare redirect params {}", params); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8151d2a..e287fd9 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,10 +1,10 @@ spring: application: - name: name - description: description + name: @name@ + description: @description@ --- info: - version: 1.0.0 + version: @version@ responsible: Anatoly Cherkasov stage: dev --- @@ -32,7 +32,7 @@ hellgate: url: http://127.0.0.1:8023/v1/proxyhost/provider --- timer: - timeout: 60 + timeout: 600 --- fixture: cards: classpath:fixture/cards.csv