Skip to content

Commit

Permalink
- Update MX version to 21.11.0
Browse files Browse the repository at this point in the history
- Update Swift Translator version to `3.11.0`
  • Loading branch information
johnmara-pc14 committed Feb 25, 2022
1 parent 138bec0 commit cfea732
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
</parent>
<groupId>com.paymentcomponents.libraries</groupId>
<artifactId>rest-sdk-wrapper</artifactId>
<version>1.8.0</version>
<version>1.8.1</version>
<name>rest-sdk-wrapper</name>
<description>Wrapper for Payment Components Financial Messaging Libraries</description>

<properties>
<java.version>1.8</java.version>
<smv.version>21.27.1</smv.version>
<mx.version>21.8.0</mx.version>
<mx.version>21.11.0</mx.version>
<sepa.version>21.6.0</sepa.version>
<swift.translator.version>3.6.0</swift.translator.version>
<swift.translator.version>3.11.0</swift.translator.version>
</properties>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
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
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()));
Expand All @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
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
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()));
Expand All @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public class TestConstants {
" <EndToEndId>090525/123COV</EndToEndId>\n" +
" <UETR>c8b66b47-2bd9-48fe-be90-93c2096f27d2</UETR>\n" +
" </PmtId>\n" +
" <IntrBkSttlmAmt Ccy=\"USD\">10500.00</IntrBkSttlmAmt>\n" +
" <IntrBkSttlmAmt Ccy=\"USD\">10500</IntrBkSttlmAmt>\n" +
" <IntrBkSttlmDt>2009-05-27</IntrBkSttlmDt>\n" +
" <SttlmTmIndctn>\n" +
" <DbtDtTm>2009-05-27T12:49:00.000+02:00</DbtDtTm>\n" +
Expand Down Expand Up @@ -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" +
Expand Down

0 comments on commit cfea732

Please sign in to comment.