switch to structured address throughout (for QR-bill 2.3)

This commit is contained in:
Michael Stapelberg
2025-10-25 10:46:35 +02:00
parent c9cd171d6f
commit 4b488515eb
2 changed files with 15 additions and 11 deletions

View File

@@ -59,12 +59,12 @@ func qrchFromRequest(r *http.Request) *qrbill.QRCH {
Ccy: "CHF",
},
UltmtDbtr: qrbill.Address{
AdrTp: qrbill.AddressType(ifEmpty(r.Form, "udaddrtype", string(qrbill.AddressTypeCombined))),
AdrTp: qrbill.AddressType(ifEmpty(r.Form, "udaddrtype", string(qrbill.AddressTypeStructured))),
Name: ifEmpty(r.Form, "udname", "Michael Stapelberg"),
StrtNmOrAdrLine1: ifEmpty(r.Form, "udaddr1", "Stauffacherstr 42"),
BldgNbOrAdrLine2: ifEmpty(r.Form, "udaddr2", "8004 Zürich"),
PstCd: ifEmpty(r.Form, "udpost", ""),
TwnNm: ifEmpty(r.Form, "udcity", ""),
StrtNmOrAdrLine1: ifEmpty(r.Form, "udaddr1", "Stauffacherstr"),
BldgNbOrAdrLine2: ifEmpty(r.Form, "udaddr2", "42"),
PstCd: ifEmpty(r.Form, "udpost", "8004"),
TwnNm: ifEmpty(r.Form, "udcity", "Zürich"),
Ctry: ifEmpty(r.Form, "udcountry", "CH"),
},
RmtInf: qrbill.QRCHRmtInf{

View File

@@ -84,10 +84,12 @@ func TestAmountValidation(t *testing.T) {
CdtrInf: qrbill.QRCHCdtrInf{
IBAN: "CH0209000000870913543",
Cdtr: qrbill.Address{
AdrTp: qrbill.AddressTypeCombined,
AdrTp: qrbill.AddressTypeStructured,
Name: "Legalize it",
StrtNmOrAdrLine1: "Quellenstrasse 25",
BldgNbOrAdrLine2: "8005 Zürich",
StrtNmOrAdrLine1: "Quellenstrasse",
BldgNbOrAdrLine2: "25",
PstCd: "8005",
TwnNm: "Zürich",
Ctry: "CH",
},
},
@@ -96,10 +98,12 @@ func TestAmountValidation(t *testing.T) {
Ccy: "CHF",
},
UltmtDbtr: qrbill.Address{
AdrTp: qrbill.AddressTypeCombined,
AdrTp: qrbill.AddressTypeStructured,
Name: "Michael Stapelberg",
StrtNmOrAdrLine1: "Stauffacherstr 42",
BldgNbOrAdrLine2: "8004 Zürich",
StrtNmOrAdrLine1: "Stauffacherstr",
BldgNbOrAdrLine2: "42",
PstCd: "8004",
TwnNm: "Zürich",
Ctry: "CH",
},
RmtInf: qrbill.QRCHRmtInf{