From b124712a453bdced7a2dd116c83d698bd44b7ae9 Mon Sep 17 00:00:00 2001 From: Daniel Sollis Date: Thu, 16 Feb 2023 14:44:15 -0600 Subject: [PATCH] bug fix for natural person validation (#117) * bug fix for natural person validation * regenerated expired certs * added type switches for legal/natural person validations * added default case --- pkg/rvasp/testdata/cert.pem | 212 ++++++++++++++++++------------------ pkg/rvasp/transfer.go | 36 +++++- 2 files changed, 136 insertions(+), 112 deletions(-) diff --git a/pkg/rvasp/testdata/cert.pem b/pkg/rvasp/testdata/cert.pem index 56f04b2..4e4acc3 100644 --- a/pkg/rvasp/testdata/cert.pem +++ b/pkg/rvasp/testdata/cert.pem @@ -1,121 +1,121 @@ -----BEGIN CERTIFICATE----- -MIIF4zCCA8ugAwIBAgICB5kwDQYJKoZIhvcNAQELBQAwgZQxDDAKBgNVBAYTA1VT +MIIF8DCCA9igAwIBAgICB5kwDQYJKoZIhvcNAQELBQAwgZQxDDAKBgNVBAYTA1VT QTELMAkGA1UECBMCTUQxEzARBgNVBAcTClF1ZWVuc3Rvd24xFjAUBgNVBAkTDTIx NSBBbHlubiBXYXkxDjAMBgNVBBETBTIxNjU4MSYwDAYDVQQKEwVUUklTQTAWBgNV -BAoTD1JvdGF0aW9uYWwgTGFiczESMBAGA1UEAxMJdHJpc2EuZGV2MB4XDTIyMDYw -NjIyNDg0MVoXDTIyMTIwNjIzNDg0MVowXTELMAkGA1UEBhMCVVMxCTAHBgNVBAgT -ADEJMAcGA1UEBxMAMQkwBwYDVQQJEwAxCTAHBgNVBBETADESMBAGA1UEChMJbG9j -YWxob3N0MQ4wDAYDVQQDEwVhbGljZTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC -AgoCggIBALXlZYRjwSx3Dk/nKRJcf70MhDemOKbXoP1pOxgXPxdjaTB/1Yroh0hL -st8s81Q0RJB2jK4QJLHmrIaJz3QkFHynoQCBP9VxZB9kKH8f1gL6O5gqasRUBSLJ -Ek4OcqSu0y0Wo+EnP73NDgh383dkKFpBvca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7Z60MJmwnr +5ao5WzK3lx/MTfFR7FMWHnukQxJf0FewzqTpJAKxAoIBAQCA+NcZxikk2Nspzx00 +IHvYxjWM4l9AVxzpRUnZl7FovR1dQifUxuruwSH7b9jRKZbYOfIenv5dN9LbQwKu +ZCNOONcnEUM1Eq8OA6EWNMpuIbbm1siWiqJxLAOhSUQcacCqvXIVQU0BomKgPE3v +BKmzJF8DGbBYv/UDy4vNMr7fHk90PRrzxHZQ+LC+VD7HUFsqPuObmYOHpdy/ynhc +RsU6XjRDGQK1VdqmZ9gL4WjB5Jc0u8lgWVMUs6u9ScrnikZxLOqsrrj0+yy5w/T+ +nz5LbTNHTIxKQ04iLwnfVL0mYtqDVlgXRaH565pyUdyL+8tLZwIoj47EejAuffxQ +m8ZxAoIBAGEORIY34djS1v0Y+mGAt7Dkv4mznqzKoKkrJZuBqYYDokQkyb5kjX/4 +Vff9n80LjuuYrVIGNw48AMCsM91Unx3+U148sUKHUJu6brTAR+ajobgJWwRIeJd5 +b/IieH6pwFs+9hVKf31J4wK3pM6BhZg0rGB/BS2/0OV1d5/ekHMwYLVgFlb7C/PX +Y9PvLLnsb5eclOeQ437PKPi2RIAgIWnzgo894nR6pv5bLXc/yE0VbPBaW+rAVLV3 +ijEkeUGsIwt+yBccErGy7y9oSx3SgqbS7B7L750LWImp9xDqnPHRmkdpcb2ucxuT +1c7WwZcUVdV0NCFQ7k++KycaEufvf6k= -----END PRIVATE KEY----- diff --git a/pkg/rvasp/transfer.go b/pkg/rvasp/transfer.go index a7434ab..9d76f54 100644 --- a/pkg/rvasp/transfer.go +++ b/pkg/rvasp/transfer.go @@ -222,9 +222,21 @@ func validateIdentityPayload(identity *ivms101.IdentityPayload, requireBeneficia } // Validate the beneficiary person - if err = identity.Beneficiary.BeneficiaryPersons[0].GetNaturalPerson().Validate(); err != nil { - log.Warn().Err(err).Msg("beneficiary person validation error") - return protocol.Errorf(protocol.ValidationError, "beneficiary person validation error: %s", err) + beneficiaryPerson := identity.Beneficiary.BeneficiaryPersons[0].GetPerson() + switch person := beneficiaryPerson.(type) { + case *ivms101.Person_NaturalPerson: + if err = person.NaturalPerson.Validate(); err != nil { + log.Warn().Err(err).Msg("beneficiary natural person validation error") + return protocol.Errorf(protocol.ValidationError, "beneficiary natural person validation error: %s", err) + } + case *ivms101.Person_LegalPerson: + if err = person.LegalPerson.Validate(); err != nil { + log.Warn().Err(err).Msg("beneficiary legal person validation error") + return protocol.Errorf(protocol.ValidationError, "beneficiary legal person validation error: %s", err) + } + default: + log.Warn().Msg(fmt.Sprintf("unknown beneficiary person type: %T", person)) + return protocol.Errorf(protocol.ValidationError, "unknown beneficiary person type: %T", person) } // Check that the account number is present @@ -246,9 +258,21 @@ func validateIdentityPayload(identity *ivms101.IdentityPayload, requireBeneficia } // Validate the beneficiary vasp entity - if err = identity.BeneficiaryVasp.BeneficiaryVasp.GetLegalPerson().Validate(); err != nil { - log.Warn().Err(err).Msg("beneficiary vasp entity validation error") - return protocol.Errorf(protocol.ValidationError, "beneficiary vasp entity validation error: %s", err) + beneficiaryVaspPerson := identity.BeneficiaryVasp.BeneficiaryVasp.GetPerson() + switch person := beneficiaryVaspPerson.(type) { + case *ivms101.Person_NaturalPerson: + if err = person.NaturalPerson.Validate(); err != nil { + log.Warn().Err(err).Msg("beneficiary vasp natural person validation error") + return protocol.Errorf(protocol.ValidationError, "beneficiary vasp natural person validation error: %s", err) + } + case *ivms101.Person_LegalPerson: + if err = person.LegalPerson.Validate(); err != nil { + log.Warn().Err(err).Msg("beneficiary vasp legal person validation error") + return protocol.Errorf(protocol.ValidationError, "beneficiary vasp legal person validation error: %s", err) + } + default: + log.Warn().Msg(fmt.Sprintf("unknown beneficiary person type: %T", person)) + return protocol.Errorf(protocol.ValidationError, "unknown beneficiary person type: %T", person) } } return nil