Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftMtMx
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
isc-v3.1-tmp
swiftMtMx
Commits
c47b1464
Commit
c47b1464
authored
Mar 29, 2024
by
gechengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交测试类
parent
35d5d7ee
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
9 deletions
+104
-9
Pacs00800108.xml
swiftCore/src/main/resources/mxjson/Pacs00800108.xml
+1
-1
MT299.txt
swiftCore/src/main/resources/swiftTxt/MT299.txt
+10
-0
Pacs00800108.xml
swiftCore/src/main/resources/swiftXml/Pacs00800108.xml
+51
-6
stp_pacs00800108_STP.xsd
swiftCore/src/main/resources/xsd/stp_pacs00800108_STP.xsd
+0
-0
Mt2MxTest.java
swiftCore/src/test/java/com/brilliance/Mt2MxTest.java
+18
-1
MxXsdValidator.java
swiftCore/src/test/java/com/brilliance/MxXsdValidator.java
+24
-1
No files found.
swiftCore/src/main/resources/mxjson/Pacs00800108.xml
View file @
c47b1464
...
@@ -312,7 +312,7 @@ Change Log
...
@@ -312,7 +312,7 @@ Change Log
<InstdAmt
Ccy=
"USD"
>
555
</InstdAmt>
<InstdAmt
Ccy=
"USD"
>
555
</InstdAmt>
<SttlmPrty>
HIGH
</SttlmPrty>
<SttlmPrty>
HIGH
</SttlmPrty>
<SttlmTmIndctn>
<SttlmTmIndctn>
<CdtDtTm>
2020-07-16T19:20:30.4
5
+01:00
</CdtDtTm>
<CdtDtTm>
2020-07-16T19:20:30.4
0
+01:00
</CdtDtTm>
<DbtDtTm>
2020-07-16T19:20:30.45+01:00
</DbtDtTm>
<DbtDtTm>
2020-07-16T19:20:30.45+01:00
</DbtDtTm>
</SttlmTmIndctn>
</SttlmTmIndctn>
<SttlmTmReq>
<SttlmTmReq>
...
...
swiftCore/src/main/resources/swiftTxt/MT299.txt
0 → 100644
View file @
c47b1464
{1:F01RBOSGB2LXXXX0000000000}{2:O2991530210409ABNANL2AXXXX00000000002301050928N}{3:{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:pacs002bizmsg299
:21:pacs8bizmsgid299
:79:/REJT/99
/AC01/addInfo
/MREF/pacs9bizmsgid299
/TREF/pacs009EndToEnd+
/TEXT//UETR/9a562c67-ca16-48ba-b074-65581be6f002
-}
\ No newline at end of file
swiftCore/src/main/resources/swiftXml/Pacs00800108.xml
View file @
c47b1464
...
@@ -33,16 +33,51 @@ Change Log
...
@@ -33,16 +33,51 @@ Change Log
<BizSvc>
swift.cbprplus.02
</BizSvc>
<BizSvc>
swift.cbprplus.02
</BizSvc>
<CreDt>
2021-04-09T09:00:00+01:00
</CreDt>
<CreDt>
2021-04-09T09:00:00+01:00
</CreDt>
</AppHdr>
</AppHdr>
<Document
xmlns=
"urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08"
>
<Document
xmlns=
"urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08"
xsi:schemaLocation=
"urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08 ../xsd/pacs00800108.xsd"
>
<!--<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08">-->
<FIToFICstmrCdtTrf>
<FIToFICstmrCdtTrf>
<GrpHdr>
<GrpHdr>
<MsgId>
pacs8bizmsgidr01
</MsgId>
<MsgId>
pacs8bizmsgidr01
</MsgId>
<CreDtTm>
2021-04-09T09:00:00+0
1:00
</CreDtTm>
<CreDtTm>
2021-04-09T09:00:00+0
2:00
</CreDtTm>
<NbOfTxs>
1
</NbOfTxs>
<NbOfTxs>
1
</NbOfTxs>
<SttlmInf>
<SttlmInf>
<SttlmMtd>
INDA
</SttlmMtd>
<SttlmMtd>
INDA
</SttlmMtd>
<SttlmAcct>
<Id>
<!--<IBAN>IK00010001</IBAN>-->
<Othr>
<Id>
00001
</Id>
</Othr>
</Id>
</SttlmAcct>
<InstgRmbrsmntAgt>
<FinInstnId>
NYCBCNSHXXX
</FinInstnId>
</InstgRmbrsmntAgt>
<InstgRmbrsmntAgtAcct>
<Id>
<!-- <IBAN>IB111</IBAN>-->
<Othr>
<Id>
111
</Id>
<Issr>
abc
</Issr>
</Othr>
</Id>
<Tp>
<Cd>
cd01
</Cd>
<!-- <Prtry></Prtry>-->
</Tp>
<Ccy>
CNY
</Ccy>
<Nm>
ny
</Nm>
<Prxy>
<Id></Id>
<Tp>
<Cd>
cd02
</Cd>
<!--<Prtry> </Prtry>-->
</Tp>
</Prxy>
</InstgRmbrsmntAgtAcct>
</SttlmInf>
</SttlmInf>
</GrpHdr>
</GrpHdr>
<CdtTrfTxInf>
<CdtTrfTxInf>
<PmtId>
<PmtId>
...
@@ -51,6 +86,9 @@ Change Log
...
@@ -51,6 +86,9 @@ Change Log
<UETR>
8a562c67-ca16-48ba-b074-65581be6f001
</UETR>
<UETR>
8a562c67-ca16-48ba-b074-65581be6f001
</UETR>
</PmtId>
</PmtId>
<PmtTpInf>
<PmtTpInf>
<CtgyPurp>
<Cd>
XX
</Cd>
</CtgyPurp>
<SvcLvl>
<SvcLvl>
<Cd>
G001
</Cd>
<Cd>
G001
</Cd>
</SvcLvl>
</SvcLvl>
...
@@ -60,8 +98,15 @@ Change Log
...
@@ -60,8 +98,15 @@ Change Log
</PmtTpInf>
</PmtTpInf>
<IntrBkSttlmAmt
Ccy=
"EUR"
>
15000000
</IntrBkSttlmAmt>
<IntrBkSttlmAmt
Ccy=
"EUR"
>
15000000
</IntrBkSttlmAmt>
<IntrBkSttlmDt>
2021-04-09
</IntrBkSttlmDt>
<IntrBkSttlmDt>
2021-04-09
</IntrBkSttlmDt>
<SttlmTmIndctn>
<CdtDtTm>
2020-07-16T19:20:30.40+01:00
</CdtDtTm>
<DbtDtTm>
2020-07-16T20:21:30.45+01:00
</DbtDtTm>
</SttlmTmIndctn>
<InstdAmt
Ccy=
"EUR"
>
11111
</InstdAmt>
<InstdAmt
Ccy=
"EUR"
>
11111
</InstdAmt>
<ChrgBr>
DEBT
</ChrgBr>
<ChrgBr>
DEBT
</ChrgBr>
<Purp>
<Prtry>
:26T:AAA
</Prtry>
</Purp>
<InstgAgt>
<InstgAgt>
<FinInstnId>
<FinInstnId>
...
@@ -103,12 +148,12 @@ Change Log
...
@@ -103,12 +148,12 @@ Change Log
<RgltryRptg>
<RgltryRptg>
<DbtCdtRptgInd>
DEBT
</DbtCdtRptgInd>
<DbtCdtRptgInd>
DEBT
</DbtCdtRptgInd>
<Authrty>
<Authrty>
<Ctry>
US
</Ctry>
<Nm>
zhangsan
</Nm>
<Nm>
zhangsan
</Nm>
<Ctry>
US
</Ctry>
</Authrty>
</Authrty>
<Dtls>
<Dtls>
<Tp>
TEST1
</Tp>
<Tp>
TEST1
</Tp>
<Dt>
2021-04-09
T09:00:00+01:00
</Dt>
<Dt>
2021-04-09
</Dt>
<Ctry>
US
</Ctry>
<Ctry>
US
</Ctry>
<Cd>
TEST1
</Cd>
<Cd>
TEST1
</Cd>
<Amt
Ccy=
"USD"
>
100
</Amt>
<Amt
Ccy=
"USD"
>
100
</Amt>
...
@@ -119,12 +164,12 @@ Change Log
...
@@ -119,12 +164,12 @@ Change Log
<RgltryRptg>
<RgltryRptg>
<DbtCdtRptgInd>
CRED
</DbtCdtRptgInd>
<DbtCdtRptgInd>
CRED
</DbtCdtRptgInd>
<Authrty>
<Authrty>
<Ctry>
CN
</Ctry>
<Nm>
lisi
</Nm>
<Nm>
lisi
</Nm>
<Ctry>
CN
</Ctry>
</Authrty>
</Authrty>
<Dtls>
<Dtls>
<Tp>
TEST2
</Tp>
<Tp>
TEST2
</Tp>
<Dt>
2022-04-
09T09:00:00+01:0
0
</Dt>
<Dt>
2022-04-
1
0
</Dt>
<Ctry>
US
</Ctry>
<Ctry>
US
</Ctry>
<Cd>
TEST2
</Cd>
<Cd>
TEST2
</Cd>
<Amt
Ccy=
"USD"
>
100
</Amt>
<Amt
Ccy=
"USD"
>
100
</Amt>
...
...
swiftCore/src/main/resources/xsd/pacs00800108_STP.xsd
→
swiftCore/src/main/resources/xsd/
stp_
pacs00800108_STP.xsd
View file @
c47b1464
File moved
swiftCore/src/test/java/com/brilliance/Mt2MxTest.java
View file @
c47b1464
...
@@ -2,9 +2,11 @@ package com.brilliance;
...
@@ -2,9 +2,11 @@ package com.brilliance;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationErrorInfo
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -48,6 +50,15 @@ public class Mt2MxTest {
...
@@ -48,6 +50,15 @@ public class Mt2MxTest {
public
void
test
(
String
source
,
Map
<
String
,
Object
>
extraMap
)
{
public
void
test
(
String
source
,
Map
<
String
,
Object
>
extraMap
)
{
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
source
));
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
source
));
try
{
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
AbstractMT
abstractMT
=
AbstractMT
.
parse
(
mtStr
);
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagValue
(
"50"
);
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
SwiftTranslationReport
str
=
SwiftTransfer
.
mt2MxPlus
(
file
,
null
,
extraMap
);
SwiftTranslationReport
str
=
SwiftTransfer
.
mt2MxPlus
(
file
,
null
,
extraMap
);
printSwiftTranslationReport
(
str
);
printSwiftTranslationReport
(
str
);
}
}
...
@@ -116,11 +127,17 @@ public class Mt2MxTest {
...
@@ -116,11 +127,17 @@ public class Mt2MxTest {
}
}
@Test
@Test
public
void
testPacs002001
()
{
public
void
testPacs002001
_199
()
{
test
(
"/swiftTxt/MT199.txt"
,
null
);
test
(
"/swiftTxt/MT199.txt"
,
null
);
}
}
@Test
@Test
public
void
testPacs002001_299
()
{
test
(
"/swiftTxt/MT299.txt"
,
null
);
}
@Test
public
void
testPacs004001
()
{
public
void
testPacs004001
()
{
test
(
"/swiftTxt/MT199.txt"
,
null
);
test
(
"/swiftTxt/MT199.txt"
,
null
);
}
}
...
...
swiftCore/src/test/java/com/brilliance/MxXsdValidator.java
View file @
c47b1464
package
com
.
brilliance
;
package
com
.
brilliance
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -13,7 +16,7 @@ public class MxXsdValidator {
...
@@ -13,7 +16,7 @@ public class MxXsdValidator {
@Test
@Test
public
void
testPacs008001
()
{
public
void
testPacs008001
()
{
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/
mxjson
/Pacs00800108.xml"
));
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/
swiftXml
/Pacs00800108.xml"
));
boolean
flag
=
SwiftTransfer
.
validateMx
(
file
);
boolean
flag
=
SwiftTransfer
.
validateMx
(
file
);
System
.
out
.
println
(
flag
);
System
.
out
.
println
(
flag
);
}
}
...
@@ -31,6 +34,26 @@ public class MxXsdValidator {
...
@@ -31,6 +34,26 @@ public class MxXsdValidator {
Pattern
pattern
=
Pattern
.
compile
(
"[A-Z0-9]{18,18}[0-9]{2,2}"
);
Pattern
pattern
=
Pattern
.
compile
(
"[A-Z0-9]{18,18}[0-9]{2,2}"
);
Matcher
m
=
pattern
.
matcher
(
str
);
Matcher
m
=
pattern
.
matcher
(
str
);
System
.
out
.
println
(
m
.
find
());
System
.
out
.
println
(
m
.
find
());
}
@Test
public
void
tagTest
()
throws
IOException
{
//File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftTxt/MT103.txt"));
File
file
=
FileUtils
.
toFile
(
Mx2MtTest
.
class
.
getResource
(
"/swiftXml/Pacs00800108.xml"
));
String
s
=
FileUtils
.
readFileToString
(
file
,
"utf-8"
);
System
.
out
.
println
(
getMxInfoByTag
(
s
,
"13C"
));
}
public
static
Object
getMxInfoByTag
(
String
swiftISOXml
,
String
tagName
)
throws
IOException
{
SwiftTranslationReport
swiftTranslationReport
=
SwiftTransfer
.
mx2MtPlus
(
swiftISOXml
,
null
,
null
);
System
.
out
.
println
(
swiftTranslationReport
.
getMessage
());
System
.
out
.
println
(
swiftTranslationReport
.
getMtType
());
System
.
out
.
println
(
swiftTranslationReport
.
getMxType
());
AbstractMT
abstractMT
=
AbstractMT
.
parse
(
swiftTranslationReport
.
getMessage
());
Tag
tag
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTagByName
(
tagName
);
return
tag
.
getValue
();
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment