Implemented transferring money with pain.001.003.03 (outdated but the only version supported by most German banks)
This commit is contained in:
parent
841b23c970
commit
31cc427fd2
|
@ -239,6 +239,10 @@ open class MessageBuilder(protected val generator: ISegmentNumberGenerator = Seg
|
||||||
return Pair(result, urn)
|
return Pair(result, urn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSepaUrnFor(CustomerSegmentId.SepaAccountInfoParameters, account, "pain.001.003.03")?.let { urn ->
|
||||||
|
return Pair(result, urn)
|
||||||
|
}
|
||||||
|
|
||||||
return Pair(MessageBuilderResult(true, false, result.allowedVersions, result.supportedVersions, null), null) // TODO: how to tell that we don't support required SEPA pain version?
|
return Pair(MessageBuilderResult(true, false, result.allowedVersions, result.supportedVersions, null), null) // TODO: how to tell that we don't support required SEPA pain version?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ open class SepaEinzelueberweisung(
|
||||||
CustomerSegmentId.SepaBankTransfer,
|
CustomerSegmentId.SepaBankTransfer,
|
||||||
1,
|
1,
|
||||||
sepaDescriptorUrn,
|
sepaDescriptorUrn,
|
||||||
"pain.001.001.03.xml",
|
if (sepaDescriptorUrn.contains("pain.001.003.03", true)) "pain.001.003.03.xml" else "pain.001.001.03.xml",
|
||||||
account.iban ?: "", // TODO: what to do if iban is not set?
|
account.iban ?: "", // TODO: what to do if iban is not set?
|
||||||
debitorBic,
|
debitorBic,
|
||||||
mapOf(
|
mapOf(
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.003.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.003.03 pain.001.003.03.xsd"><CstmrCdtTrfInitn><GrpHdr><MsgId>$MessageId$</MsgId><CreDtTm>$CreationDateTime$</CreDtTm><NbOfTxs>$NumberOfTransactions$</NbOfTxs><InitgPty><Nm>$DebitorName$</Nm></InitgPty></GrpHdr><PmtInf><PmtInfId>$PaymentInformationId$</PmtInfId><PmtMtd>TRF</PmtMtd><BtchBookg>true</BtchBookg><NbOfTxs>$NumberOfTransactions$</NbOfTxs><CtrlSum>$Amount$</CtrlSum><PmtTpInf><SvcLvl><Cd>SEPA</Cd></SvcLvl></PmtTpInf><ReqdExctnDt>$RequestedExecutionDate$</ReqdExctnDt><Dbtr><Nm>$DebitorName$</Nm></Dbtr><DbtrAcct><Id><IBAN>$DebitorIban$</IBAN></Id></DbtrAcct><DbtrAgt><FinInstnId><BIC>$DebitorBic$</BIC></FinInstnId></DbtrAgt><ChrgBr>SLEV</ChrgBr><CdtTrfTxInf><PmtId><EndToEndId>NOTPROVIDED</EndToEndId></PmtId><Amt><InstdAmt Ccy="EUR">$Amount$</InstdAmt></Amt><CdtrAgt><FinInstnId><BIC>$CreditorBic$</BIC></FinInstnId></CdtrAgt><Cdtr><Nm>$CreditorName$</Nm></Cdtr><CdtrAcct><Id><IBAN>$CreditorIban$</IBAN></Id></CdtrAcct><RmtInf><Ustrd>$Usage$</Ustrd></RmtInf></CdtTrfTxInf></PmtInf></CstmrCdtTrfInitn></Document>
|
|
@ -9,10 +9,8 @@ import org.junit.Test
|
||||||
|
|
||||||
class SepaEinzelueberweisungTest {
|
class SepaEinzelueberweisungTest {
|
||||||
|
|
||||||
@Test
|
companion object {
|
||||||
fun format() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
val segmentNumber = 7
|
val segmentNumber = 7
|
||||||
val debitorName = "Nelson Mandela"
|
val debitorName = "Nelson Mandela"
|
||||||
val debitorIban = "ZA123456780987654321"
|
val debitorIban = "ZA123456780987654321"
|
||||||
|
@ -23,6 +21,13 @@ class SepaEinzelueberweisungTest {
|
||||||
val amount = 1234.56.toBigDecimal()
|
val amount = 1234.56.toBigDecimal()
|
||||||
val usage = "What should Mahatma Gandhi want with money?"
|
val usage = "What should Mahatma Gandhi want with money?"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun format_Pain001_001_03() {
|
||||||
|
|
||||||
|
// given
|
||||||
val underTest = SepaEinzelueberweisung(segmentNumber,
|
val underTest = SepaEinzelueberweisung(segmentNumber,
|
||||||
"urn:iso:std:iso:20022:tech:xsd:pain.001.001.03",
|
"urn:iso:std:iso:20022:tech:xsd:pain.001.001.03",
|
||||||
CustomerData("", "", "", debitorName),
|
CustomerData("", "", "", debitorName),
|
||||||
|
@ -40,4 +45,27 @@ class SepaEinzelueberweisungTest {
|
||||||
assertThat(result).contains(debitorName, debitorIban, debitorBic, creditorName, creditorIban, creditorBic,
|
assertThat(result).contains(debitorName, debitorIban, debitorBic, creditorName, creditorIban, creditorBic,
|
||||||
amount.toString(), usage, "urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03")
|
amount.toString(), usage, "urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun format_Pain001_003_03() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
val underTest = SepaEinzelueberweisung(segmentNumber,
|
||||||
|
"urn:iso:std:iso:20022:tech:xsd:pain.001.003.03",
|
||||||
|
CustomerData("", "", "", debitorName),
|
||||||
|
AccountData("", null, 0, "", debitorIban, "", null, null, "", null, null, listOf()),
|
||||||
|
debitorBic,
|
||||||
|
BankTransferData(creditorName, creditorIban, creditorBic, amount, usage)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
// when
|
||||||
|
val result = underTest.format()
|
||||||
|
|
||||||
|
|
||||||
|
// then
|
||||||
|
assertThat(result).contains(debitorName, debitorIban, debitorBic, creditorName, creditorIban, creditorBic,
|
||||||
|
amount.toString(), usage, "urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.003.03")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue