sveawebpay / dotnet-integration

SDK for Sveas standalone payment methods
Other
5 stars 14 forks source link

Possible bug: SetCountryCode() #19

Closed fredrik-stigsson closed 10 years ago

fredrik-stigsson commented 10 years ago

The part that I have commented out does not provide a good result when it is running.

public override CreateOrderBuilder SetCountryCode(CountryCode countryCode) { CountryCode = countryCode; if (CustomerId != null) { CustomerId.CountryCode = countryCode.ToString().ToUpper();

            //if (CountryCode == CountryCode.SE && CustomerId.CustomerType == CustomerType.Company)
            //{
            //    CustomerId.NationalIdNumber = CustomerId.CompanyIdentity.CompanyVatNumber ??
            //                                  CustomerId.NationalIdNumber;
            //    CustomerId.CompanyIdentity = null;
            //}
        }

        _hasSetCountryCode = true;
        return this;
    }</code>
Sinsabre commented 10 years ago

As far as I can tell the code does what it's supposed to do. Do you have an example on a case where it doesn't?

fredrik-stigsson commented 10 years ago

It will set the nationalIdNumber to the VAT-number or to an empty string. I got a InvalidCustomerData response or NationalId is missing response.

Sinsabre commented 10 years ago

It will set CustomerId.NationalIdNumber to CustomerId.CompanyIdentity.CompanyVatNumber if CustomerId.CompanyIdentity.CompanyVatNumber isn't NULL. If CustomerId.CompanyIdentity.CompanyVatNumber is NULL it will set CustomerId.NationalIdNumber to CustomerId.NationalIdNumber. As I see it the only way to make it set CustomerId.NationalIdNumber to an empty string is to either specify CustomerId.CompanyIdentity.CompanyVatNumber or CustomerId.NationalIdNumber as "".

fredrik-stigsson commented 10 years ago

When I got the first error I had the VatNumber as "". Then I entered SE460814222201 as the VAT-number and got the second error.

Why do you want to set the VAT-number as the NationalId number? I think it is better to just remove those lines in the code. I have done that and it works fine.

fredrik-stigsson commented 10 years ago

Is this code for Germany and Holland? Should I not set the CustomerId.CompanyIdentity.CompanyVatNumber for customers with a NationalIdNumber?

Sinsabre commented 10 years ago

In other words the code performed correctly since it wasn't NULL in the first case and 4608142222 would have been the correct formatting in the second case. All code in the integration package serves a purpose in talking with the internal systems at SveaWebpay so you can't just remove parts of the code and hope for the best.

No the code is for Swedish companied only: "if (CountryCode == CountryCode.SE".

Since this is obviously not a bug or code problem but rather an integration issue I would urge you to contact Svea Webpay on support-webpay@sveaekonomi.se instead.

fredrik-stigsson commented 10 years ago

Thank you for the email-address and thank you for taking the time to answer my questions.