sveawebpay / dotnet-integration Goto Github PK
View Code? Open in Web Editor NEWSDK for Sveas standalone payment methods
License: Other
SDK for Sveas standalone payment methods
License: Other
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());
}
}
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.
We have a convention to always put the properties in the top of a class definition.
class Class
{
// Properties
bool IsTrue {get;set;}
public Class()
{
}
}
The underlying services used by the integration package allows for Decimal Quantity. Should be reflected in the integration package.
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());
}
How Can I handle response in return url?
I mean how to get response parameter and by which class.
I use mvc.
We should create a proper integration document for the dotnet-package.
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.
SveaResponse only exposes ResultCode as a formatted string - we need access to the raw (int32) status code from the XML. Please add StatusCode property!
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.
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.
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();
}
The project contains some code duplication.
Should be removed.
The test login details for the specified countries are not valid for the Invoice and PaymentPlan-functions.
Should replace them with the correct ones.
decimal is a base type and should be used as such,.
var value = new Decimal(100.0);
should be replaced with:
var value = 100.00M;
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.
Is there any way that this could be targeted Net standard so that it can be used in .Net Core?
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>
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.
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>
To avoid changing javascript form POST code (if name/id not equal to "paymentForm" in client code) - you should be able to set id and name. Proposed fix in pull request: #32
Would be great if you could add dotnet-integration to nuget.org
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.
}
The package is currently quite sparse in its use of more advanced C# features.
Go through the code and see where we can use such functionality as LINQ.
Prefer to use the == operator instead of .Equals()
It is easier to read with ==.
if(foo.Equals(bar))
{
}
// Better && more C#
if(foo == bar)
{
}
var hostedAdmin = new HostedAdmin(config, countryCode);
var request = hostedAdmin.Query(new QueryByCustomerRefNo(orderId));
var sveaResponse = request.DoRequest<QueryResponse>();
When config.GetEndPoint() implementation returns SveaConfig.GetProdHostedAdminUrl() - the URL that gets queried is /rest/rest
Property "CardType" exists in your legacy client lib Webpay.EPayment.Integration 2.4.0.0 - but missing in dotnet-integration source. We use this property and need it - can you please add it to the source code?
We use it from the response when querying using QueryByCustomerRefNo.
Move the integration tests to a separate project or folder, like in the PHP and Java integration packages.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.