JD-770: support GET in `*/acs (#29) (#1)

* support GET in ``*/acs`
* migrate to java 15 and junit5
This commit is contained in:
mr-impossibru 2021-12-23 21:19:43 +03:00 committed by GitHub
parent 5f7ec60145
commit 68a7e72402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 39 additions and 34 deletions

View File

@ -1,4 +1,4 @@
extraction:
java:
index:
java_version: "11"
java_version: "15"

7
Jenkinsfile vendored
View File

@ -5,12 +5,11 @@ build('proxy-mocketbank-mpi', 'java-maven') {
def javaServicePipeline
runStage('load JavaService pipeline') {
javaServicePipeline = load("build_utils/jenkins_lib/pipeJavaService.groovy")
javaServicePipeline = load("build_utils/jenkins_lib/pipeJavaServiceInsideDocker.groovy")
}
def serviceName = env.REPO_NAME
def mvnArgs = '-DjvmArgs="-Xmx256m"'
def useJava11 = true
javaServicePipeline(serviceName, useJava11, mvnArgs)
}
javaServicePipeline(serviceName, mvnArgs)
}

@ -1 +1 @@
Subproject commit f42e059d9ec93826ba4ad23232eed8ce67bd5486
Subproject commit a87ebf3ae5e56910dc6a0edcac7f90565368a3d1

13
pom.xml
View File

@ -7,12 +7,12 @@
<parent>
<groupId>com.rbkmoney</groupId>
<artifactId>service-parent-pom</artifactId>
<version>1.1.1</version>
<version>2.0.15</version>
<relativePath/>
</parent>
<artifactId>proxy-mocketbank-mpi</artifactId>
<version>1.0.7-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>proxy-mocketbank-mpi</name>
@ -20,7 +20,8 @@
<properties>
<server.port>8080</server.port>
<exposed.ports>${server.port}</exposed.ports>
<management.port>8023</management.port>
<exposed.ports>${server.port} ${management.port}</exposed.ports>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.maintainer>Anatoly Cherkasov &lt;a.cherkasov@rbkmoney.com&gt;</project.maintainer>
<dockerfile.base.service.tag>c0612d6052ac049496b72a23a04acb142035f249</dockerfile.base.service.tag>
@ -33,14 +34,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>spring-boot-starter-metrics-statsd</artifactId>
<version>1.1.2</version>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -56,7 +56,7 @@ public class Mpi20Controller {
return model;
}
@RequestMapping(value = "/acs", method = RequestMethod.POST)
@RequestMapping(value = "/acs", method = {RequestMethod.POST, RequestMethod.GET})
public ModelAndView acs(@RequestParam(value = "creq") String creq,
@RequestParam(value = "TermUrl") String termUrl) {
log.info("Form ACS 2.0 input params: creq {}, termUrl {}", creq, termUrl);

View File

@ -72,19 +72,16 @@ public class MpiController {
if (card.isPresent()) {
MpiAction action = MpiAction.findByValue(card.get().getAction());
switch (action) {
case THREE_D_SECURE_SUCCESS:
case THREE_D_SECURE_SUCCESS -> {
map.put("transactionStatus", MpiTransactionStatus.AUTHENTICATION_SUCCESSFUL);
map.put("eci", "1");
map.put("cavv", "3");
map.put("cavvAlgorithm", MpiCavvAlgorithm.CVV_WITH_ATN);
map.put("txId", UUID.randomUUID().toString());
map.put("txTime", LocalDateTime.now().format(DateTimeFormatter.ofPattern(DATETIME_PATTERN)));
break;
case THREE_D_SECURE_FAILURE:
map.put("transactionStatus", MpiTransactionStatus.AUTHENTICATION_FAILED);
break;
default:
map.put("transactionStatus", MpiTransactionStatus.ATTEMPTS_PROCESSING_PERFORMED);
}
case THREE_D_SECURE_FAILURE -> map.put("transactionStatus", MpiTransactionStatus.AUTHENTICATION_FAILED);
default -> map.put("transactionStatus", MpiTransactionStatus.ATTEMPTS_PROCESSING_PERFORMED);
}
} else {
map.put("transactionStatus", MpiTransactionStatus.AUTHENTICATION_COULD_NOT_BE_PERFORMED);
@ -95,7 +92,7 @@ public class MpiController {
return response;
}
@RequestMapping(value = "acs", method = RequestMethod.POST)
@RequestMapping(value = "acs", method = {RequestMethod.POST, RequestMethod.GET})
public ModelAndView formAcs(
@RequestParam(value = "PaReq") String paReq,
@RequestParam(value = "MD") String md,

View File

@ -15,15 +15,10 @@ public class CardUtils {
boolean result = false;
if (card.isPresent()) {
MpiAction action = MpiAction.findByValue(card.get().getAction());
switch (action) {
case THREE_D_SECURE_FAILURE:
case THREE_D_SECURE_TIMEOUT:
case THREE_D_SECURE_SUCCESS:
result = true;
break;
default:
result = false;
}
result = switch (action) {
case THREE_D_SECURE_FAILURE, THREE_D_SECURE_TIMEOUT, THREE_D_SECURE_SUCCESS -> true;
default -> false;
};
}
return result;
}

View File

@ -9,10 +9,27 @@ info:
stage: dev
---
management:
security:
flag: false
server:
port: '@management.port@'
metrics:
export:
statsd:
flavor: etsy
prometheus:
enabled: false
endpoint:
health:
show-details: always
metrics:
enabled: true
prometheus:
enabled: true
endpoints:
web:
exposure:
include: health,info,prometheus
---
server:
port: @server.port@

View File

@ -1,8 +1,8 @@
package com.rbkmoney.proxy.mocketbank.mpi.utils;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class MpiUtilsTest {