|
|
|
@ -47,6 +47,11 @@ func (p *PainXML) Valid() error { |
|
|
|
if len(p.PaymentInformation) < 1 { |
|
|
|
err = append(err, "no payment information") |
|
|
|
} |
|
|
|
for i, pi := range p.PaymentInformation { |
|
|
|
if e := pi.Valid(); e != nil { |
|
|
|
err = append(err, fmt.Sprintf("payment information at %d has errors: %v", i, e)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if len(err) > 0 { |
|
|
|
return fmt.Errorf("pain XML not valid: %v", strings.Join(err, ", ")) |
|
|
|
@ -115,12 +120,13 @@ type PartyIdSEPA1 struct { |
|
|
|
} |
|
|
|
|
|
|
|
type PartyIdSEPA3 struct { |
|
|
|
Id PartySEPA2 `xml:"Id"` |
|
|
|
// Embed PartySEPA2, because we do not need another level of <Id>
|
|
|
|
PartySEPA2 |
|
|
|
} |
|
|
|
|
|
|
|
func NewPartyIdSEPA3(id string) PartyIdSEPA3 { |
|
|
|
return PartyIdSEPA3{ |
|
|
|
Id: PartySEPA2{ |
|
|
|
PartySEPA2{ |
|
|
|
PrivateId: PersonIdSEPA2{ |
|
|
|
Other: RestrictedPersonIdSEPA{ |
|
|
|
Id: id, |
|
|
|
@ -134,7 +140,7 @@ func NewPartyIdSEPA3(id string) PartyIdSEPA3 { |
|
|
|
} |
|
|
|
|
|
|
|
func (p *PartyIdSEPA3) Valid() error { |
|
|
|
return p.Id.Valid() |
|
|
|
return p.Valid() |
|
|
|
} |
|
|
|
|
|
|
|
type PersonIdSEPA2 struct { |
|
|
|
@ -166,7 +172,7 @@ func (r *RestrictedPersonIdSEPA) Valid() error { |
|
|
|
} |
|
|
|
|
|
|
|
type RestrictedPersonIdSchemeNameSEPA struct { |
|
|
|
Party string `xml:"Prty"` // IdentificationSchemeNameSEPA
|
|
|
|
Party string `xml:"Prtry"` // IdentificationSchemeNameSEPA
|
|
|
|
} |
|
|
|
|
|
|
|
func (r *RestrictedPersonIdSchemeNameSEPA) Valid() error { |
|
|
|
|