SwedbankPay / swedbank-pay-sdk-dotnet

Swedbank Pay SDK for .NET (Beta)

Home Page:https://www.nuget.org/packages/SwedbankPay.Sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EmailAddress class validation not conforming to RFC

DegJ opened this issue · comments

Having an issue with the EmailAddress class that validates in its ctor.
The regex that is used seems to not conform to RFC https://tools.ietf.org/html/rfc2822#section-3.2.4.
For example:
a@a.com validates but a_@a.com does not validate, but both are valid email addresses according to spec.

I've tried with a few other email variants and it does seem that most special characters that can be used in emails cant be used at the start or end of the local-part of the email. Trying with Postman against the service directly (POST https://api.externalintegration.payex.com/psp/paymentorders) there doesn't seem to be any validation for the email. So perhaps the validation is not needed or could be turned of perhaps?

Trying to omit the Email from the RiskIndicator class for example causes a null pointer exception.

I was thinking about perhaps usage of new EmailAddressAttribute().IsValid() but it really doesn't do anything more than just checks that a @ is included and something at all is before and something is after the @. So that could be to "little" validation if there should be something.