Giter VIP home page Giter VIP logo

dotnet-integration's People

Contributors

adil-irshad avatar brolund avatar henkish avatar itssimple avatar jona-lit avatar kilskrift avatar mlvochin avatar nlii avatar ornfelt avatar savogar avatar sebastianruthstrom avatar sinsabre avatar sternert avatar sveateam avatar theconfuser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotnet-integration's Issues

Method GetIpAddress() should be in Customer.

At the moment the GetIpAddress() is located in the
sub-classes IndividualCustomer and CompanyCustomer.

This forces an unneccessary cast which can be easily avoided.

if (order.GetIsCompanyIdentity())
            {
                if (order.GetCompanyCustomer().GetIpAddress() != null)
                {
                    WriteSimpleElement("ipaddress", order.GetCompanyCustomer().GetIpAddress());
                }
            }
            else
            {
                if (order.GetIndividualCustomer().GetIpAddress() != null)
                {
                    WriteSimpleElement("ipaddress", order.GetIndividualCustomer().GetIpAddress());
                }
            }

bug in card payment cancellation

Hi.
there is a bug inside card payment.
when we redirect to bank url for payment in first page we can cancel the process.
when we press cancel , we face an error in code that says transaction number is not found.
but if we choose a card (visa , master ) and press cancel in second page , there is no problem and everything is fine.
Thanks in advanced.

Remove redundant try-catch-Console.WriteLines

The code has some redundant try-catches. In most cases the user of the code should handle the error themselves.

Where some of the Try-Catches also includes:

try
{
   /// something
}
catch(Exception ex)
{
    Console.WriteLine(ex.ToString());
}

OrderDate should be of type DateTime.

There is absolutely no reason for the OrderDate to be of type string.

Use the datatype DateTime which exists in C# and format the date to the specific underlying usages.

HostedXmlBuilder.cs contains a bug.

When calling the method GetXml the class member _xmlw is created inside of an
using block. This causes the XmlWriter to be disposed when the block finishes and the locally stored variable is thus useless.

Change so that there is no local variable in the class for the XmlWriter and use the functionality in C# correctly.

using (_xmlw = XmlWriter.Create(xmlOutput, xmlSettings))
{
   // Omited for clarity.
}

_xmlw.Something(); <--- The variable is disposed here and most likely throws an Exception if being called upon.


All machine-read ToString() should be CultureInvariant.

Most data that is being parsed into Xml-messages have no culture specified and can thus depending on the running environment be formatted differently.

Should specify:

var xmlValue = myInt.ToString(CultureInfo.InvariantCulture);

for all these cases to avoid future problems.

Duplicate null-checks in HostedXmlBuilder.cs

When adding a new element to the XmlWriter the value is checked for null.

Later inside the method that adds the valud to the Writer, the value is checked for null again.

Example:

if (individualIdentity.FirstName != null)
{
      WriteSimpleElement("firstname", individualIdentity.FirstName);
}

private void WriteSimpleElement(string name, string value)
{
     if (value == null)
     {
         return;
     }

     _xmlw.WriteStartElement(name);

     if (!value.Equals(""))
     {
          _xmlw.WriteChars(value.ToCharArray(), 0, value.ToCharArray().Length);
     }
    _xmlw.WriteEndElement();
}

Code duplication

The project contains some code duplication.

Should be removed.

Mixed bracket-styles

The bracket-style in the integration-package is mixed.

We have both

if(x == true){
}

and

if(x == true)
{
}

We should use the second style in this project.

Net standard

Is there any way that this could be targeted Net standard so that it can be used in .Net Core?

SveaResponse (Hosted) Crashes

Hello,

It's a problem when getting back a SveaResponse, With a "invalidtransaction" xml tag.

For example:
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48cmVzcG9uc2U+PGludmFsaWR0cmFuc2FjdGlvbj48Y3VzdG9tZXJyZWZubz5PcmRlck5yOjU0NDQ2LTk0MjdjMzUyMWY3YjQ4NzQ5ZWNkOWU4YTYzZmM2NjUzPC9jdXN0b21lcnJlZm5vPjwvaW52YWxpZHRyYW5zYWN0aW9uPjxzdGF0dXNjb2RlPjMyNTwvc3RhdHVzY29kZT48L3Jlc3BvbnNlPg==

Result in this XML.

<?xml version="1.0" encoding="UTF-8"?><response><invalidtransaction><customerrefno>OrderNr:54446-9427c3521f7b48749ecd9e8a63fc6653</customerrefno></invalidtransaction><statuscode>325</statuscode></response>

Refactor the tests for the package.

While trying to change the OrderDate to DateTime alot of boilerplate code needed to get updated. Should refactor and minimize code duplication for easier maintainabilty of our tests.

Possible bug: SetCountryCode()

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>

NuGet Package

Would be great if you could add dotnet-integration to nuget.org

Use Is and As instead of GetType()

Creating new objects just to compare types is not effective. ( And also not the C# way of life. )

Better to use:

var specificObject = generalObject as MySpecificObject;
if(specificObject != null)
{
   // Do something awesome with my typesafe object.
}

Comparisons

Prefer to use the == operator instead of .Equals()

It is easier to read with ==.

if(foo.Equals(bar))
{
}

// Better && more C#
if(foo == bar)
{

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.