diff --git a/pom.xml b/pom.xml
index d32a164..9c14359 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,16 +10,16 @@
com.paymentcomponents.libraries
rest-sdk-wrapper
- 1.8.0
+ 1.8.1
rest-sdk-wrapper
Wrapper for Payment Components Financial Messaging Libraries
1.8
21.27.1
- 21.8.0
+ 21.11.0
21.6.0
- 3.6.0
+ 3.11.0
diff --git a/src/main/java/com/paymentcomponents/libraries/rest/sdk/wrapper/service/CbprTranslatorService.java b/src/main/java/com/paymentcomponents/libraries/rest/sdk/wrapper/service/CbprTranslatorService.java
index 20c6047..5ced282 100644
--- a/src/main/java/com/paymentcomponents/libraries/rest/sdk/wrapper/service/CbprTranslatorService.java
+++ b/src/main/java/com/paymentcomponents/libraries/rest/sdk/wrapper/service/CbprTranslatorService.java
@@ -4,8 +4,10 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.paymentcomponents.libraries.rest.sdk.wrapper.exception.InvalidMessageException;
import gr.datamation.swift.translator.cbpr.CbprTranslator;
+import gr.datamation.swift.translator.cbpr.utils.CbprMessageValidationUtils;
import gr.datamation.swift.translator.common.exceptions.InvalidMtMessageException;
import gr.datamation.swift.translator.common.exceptions.InvalidMxMessageException;
+import gr.datamation.swift.translator.common.utils.MtMessageValidationUtils;
import org.springframework.stereotype.Service;
@Service
@@ -13,7 +15,9 @@ public class CbprTranslatorService {
public String translateMtToMx(String mtMessage) throws InvalidMessageException, JsonProcessingException {
try {
- return CbprTranslator.translateMtToMx(mtMessage);
+ String translatedMessage = CbprTranslator.translateMtToMx(mtMessage); //throws InvalidMtMessageException
+ CbprMessageValidationUtils.autoParseAndValidateCbprMessage(translatedMessage); //throws InvalidMxMessageException
+ return translatedMessage;
} catch (InvalidMtMessageException ex) {
throw new InvalidMessageException(
new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(ex.getValidationErrorList()));
@@ -28,7 +32,9 @@ public String translateMtToMx(String mtMessage) throws InvalidMessageException,
public String translateMxToMt(String mxMessage) throws InvalidMessageException, JsonProcessingException {
try {
- return CbprTranslator.translateMxToMt(mxMessage);
+ String translatedMessage = CbprTranslator.translateMxToMt(mxMessage); //throws InvalidMxMessageException
+ MtMessageValidationUtils.parseAndValidateMtMessage(translatedMessage); //throws InvalidMtMessageException
+ return translatedMessage;
} catch (InvalidMxMessageException ex) {
throw new InvalidMessageException(
new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(ex.getValidationErrorList()));
diff --git a/src/main/java/com/paymentcomponents/libraries/rest/sdk/wrapper/service/RtgsTranslatorService.java b/src/main/java/com/paymentcomponents/libraries/rest/sdk/wrapper/service/RtgsTranslatorService.java
index 649003a..a3e0e66 100644
--- a/src/main/java/com/paymentcomponents/libraries/rest/sdk/wrapper/service/RtgsTranslatorService.java
+++ b/src/main/java/com/paymentcomponents/libraries/rest/sdk/wrapper/service/RtgsTranslatorService.java
@@ -6,6 +6,7 @@
import gr.datamation.swift.translator.common.exceptions.InvalidMtMessageException;
import gr.datamation.swift.translator.common.exceptions.InvalidMxMessageException;
import gr.datamation.swift.translator.rtgs.RtgsTranslator;
+import gr.datamation.swift.translator.rtgs.utils.RtgsMessageValidationUtils;
import org.springframework.stereotype.Service;
@Service
@@ -13,7 +14,9 @@ public class RtgsTranslatorService {
public String translateMtToMx(String mtMessage) throws InvalidMessageException, JsonProcessingException {
try {
- return RtgsTranslator.translateMtToMx(mtMessage);
+ String translatedMessage = RtgsTranslator.translateMtToMx(mtMessage); //throws InvalidMtMessageException
+ RtgsMessageValidationUtils.autoParseAndValidateRtgsMessage(translatedMessage); //throws InvalidMxMessageException
+ return translatedMessage;
} catch (InvalidMtMessageException ex) {
throw new InvalidMessageException(
new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(ex.getValidationErrorList()));
@@ -28,7 +31,7 @@ public String translateMtToMx(String mtMessage) throws InvalidMessageException,
public String translateMxToMt(String mxMessage) throws InvalidMessageException, JsonProcessingException {
try {
- return RtgsTranslator.translateMxToMt(mxMessage);
+ return RtgsTranslator.translateMxToMt(mxMessage); //output should not validated for now
} catch (InvalidMxMessageException ex) {
throw new InvalidMessageException(
new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(ex.getValidationErrorList()));
diff --git a/src/test/java/com/paymentcomponents/libraries/rest/sdk/wrapper/TestConstants.java b/src/test/java/com/paymentcomponents/libraries/rest/sdk/wrapper/TestConstants.java
index bdc69e1..31d31c2 100644
--- a/src/test/java/com/paymentcomponents/libraries/rest/sdk/wrapper/TestConstants.java
+++ b/src/test/java/com/paymentcomponents/libraries/rest/sdk/wrapper/TestConstants.java
@@ -343,7 +343,7 @@ public class TestConstants {
" 090525/123COV\n" +
" c8b66b47-2bd9-48fe-be90-93c2096f27d2\n" +
" \n" +
- " 10500.00\n" +
+ " 10500\n" +
" 2009-05-27\n" +
" \n" +
" 2009-05-27T12:49:00.000+02:00\n" +
@@ -489,7 +489,7 @@ public class TestConstants {
":20:987\n" +
":21:NOTPROVIDED\n" +
":13C:/SNDTIME/1249+0200\n" +
- ":32A:090527USD10500,00\n" +
+ ":32A:090527USD10500,\n" +
":52A:BKAUATWW\n" +
":56A:TESTBICD\n" +
":57A:/CDTRAGTACCT\n" +