From c090eb57c226775d297b986cb23b15d40e8853ae Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 10 Sep 2020 09:26:43 +0200 Subject: [PATCH] add craddrtype field, switch to structured by default for revolut The revolut app does not seem to support the combined address type. Luckily, switching to structured seems to not be a problem for other apps such as the ZKB eBanking app. --- cmd/qrbill-api/api.go | 10 +++++----- qrbill.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/qrbill-api/api.go b/cmd/qrbill-api/api.go index 5ea0371..64bb5bc 100644 --- a/cmd/qrbill-api/api.go +++ b/cmd/qrbill-api/api.go @@ -46,12 +46,12 @@ func qrchFromRequest(r *http.Request) *qrbill.QRCH { CdtrInf: qrbill.QRCHCdtrInf{ IBAN: ifEmpty(r.Form, "criban", "CH0209000000870913543"), Cdtr: qrbill.Address{ - AdrTp: qrbill.AddressTypeCombined, + AdrTp: qrbill.AddressType(ifEmpty(r.Form, "craddrtype", string(qrbill.AddressTypeStructured))), Name: ifEmpty(r.Form, "crname", "Legalize it!"), StrtNmOrAdrLine1: ifEmpty(r.Form, "craddr1", "Quellenstrasse 25"), - BldgNbOrAdrLine2: ifEmpty(r.Form, "craddr2", "8005 Zürich"), - PstCd: ifEmpty(r.Form, "crpost", ""), - TwnNm: ifEmpty(r.Form, "crcity", ""), + BldgNbOrAdrLine2: ifEmpty(r.Form, "craddr2", ""), + PstCd: ifEmpty(r.Form, "crpost", "8005"), + TwnNm: ifEmpty(r.Form, "crcity", "Zürich"), Ctry: ifEmpty(r.Form, "crcountry", "CH"), }, }, @@ -60,7 +60,7 @@ func qrchFromRequest(r *http.Request) *qrbill.QRCH { Ccy: "CHF", }, UltmtDbtr: qrbill.Address{ - AdrTp: qrbill.AddressType(ifEmpty(r.Form, "udaddrtype", qrbill.AddressTypeCombined)), + AdrTp: qrbill.AddressType(ifEmpty(r.Form, "udaddrtype", string(qrbill.AddressTypeCombined))), Name: ifEmpty(r.Form, "udname", "Michael Stapelberg"), StrtNmOrAdrLine1: ifEmpty(r.Form, "udaddr1", "Stauffacherstr 42"), BldgNbOrAdrLine2: ifEmpty(r.Form, "udaddr2", "8004 Zürich"), diff --git a/qrbill.go b/qrbill.go index 221d959..020ef3f 100644 --- a/qrbill.go +++ b/qrbill.go @@ -70,7 +70,7 @@ type AddressType string const ( AddressTypeStructured AddressType = "S" - AddressTypeCombined = "K" + AddressTypeCombined AddressType = "K" ) type Address struct {