Skip to content

Commit

Permalink
Release 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RytisRe committed Dec 13, 2022
1 parent 144204e commit d8f8f8b
Show file tree
Hide file tree
Showing 207 changed files with 3,536 additions and 6,324 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publishing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
nuget restore Wallee.sln
nuget install NUnit.Console -Version 3.11.1 -OutputDirectory testrunner
msbuild /t:restore Wallee.sln && msbuild Wallee.sln /t:build /p:Configuration=Release
mono testrunner/NUnit.ConsoleRunner.3.11.1/tools/nunit3-console.exe ./src/Wallee.Test/bin/Release/net452/Wallee.Test.dll --inprocess
mono testrunner/NUnit.ConsoleRunner.3.11.1/tools/nunit3-console.exe ./src/Wallee.Test/bin/Release/net5.0/Wallee.Test.dll --inprocess
publish:
needs: build
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ The wallee C# library wraps around the wallee API. This library facilitates your

<a name="frameworks-supported"></a>
## Frameworks supported
- .NET 4.5 or later
- .NET 4.6.1 or later
- Windows Phone 7.1 (Mango)

<a name="dependencies"></a>
## Dependencies
- [RestSharp](https://www.nuget.org/packages/RestSharp) - [106.2.1, 107)
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 108.0.1
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.1
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.6.0

Expand All @@ -26,19 +26,18 @@ Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
```

NOTE: RestSharp versions greater than [106.2.1, 107) have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)

<a name="installation"></a>
## Installation
```
# Package Manager
Install-Package Wallee -Version 4.3.11
Install-Package Wallee -Version 5.0.0
# .NET CLI
dotnet add package Wallee --version 4.3.11
dotnet add package Wallee --version 5.0.0
# Paket CLI
paket add Wallee --version 4.3.11
paket add Wallee --version 5.0.0
# PackageReference
<PackageReference Include="Wallee" Version="4.3.11" />
<PackageReference Include="Wallee" Version="5.0.0" />
```

Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
Expand Down
5 changes: 3 additions & 2 deletions src/Wallee.Test/Wallee.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<AssemblyName>Wallee.Test</AssemblyName>
Expand All @@ -19,14 +19,15 @@

<ItemGroup>
<PackageReference Include="NUnit" Version="3.9.0"/>
<PackageReference Include="RestSharp" Version="[106.2.1, 107)"/>
<PackageReference Include="RestSharp" Version="108.0.1"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
<PackageReference Include="JsonSubTypes" Version="1.6.0"/>
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="System"/>
<Reference Include="System.Net.Http"/>
<Reference Include="System.Core"/>
<Reference Include="System.Xml.Linq"/>
<Reference Include="System.Data.DataSetExtensions"/>
Expand Down
33 changes: 20 additions & 13 deletions src/Wallee/Client/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public partial class ApiClient
/// Allows for extending request processing for <see cref="ApiClient"/> generated code.
/// </summary>
/// <param name="request">The RestSharp request object</param>
partial void InterceptRequest(IRestRequest request);
partial void InterceptRequest(RestRequest request);

/// <summary>
/// Allows for extending response processing for <see cref="ApiClient"/> generated code.
/// </summary>
/// <param name="request">The RestSharp request object</param>
/// <param name="response">The RestSharp response object</param>
partial void InterceptResponse(IRestRequest request, IRestResponse response);
partial void InterceptResponse(RestRequest request, RestResponse response);

/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" /> class
Expand Down Expand Up @@ -123,12 +123,12 @@ private RestRequest PrepareRequest(
// add file parameter, if any
foreach(var param in fileParams)
{
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentLength, param.Value.ContentType);
request.AddFile(param.Value.Name, param.Value.FileName, param.Value.ContentType);
}

if (postBody != null) // http body (model or byte[]) parameter
{
request.AddParameter(contentType, postBody, ParameterType.RequestBody);
request.AddBody(postBody, contentType);
}

return request;
Expand All @@ -155,7 +155,7 @@ public Object CallApi(
{

Dictionary<String, String> defaultHeaderParams = new Dictionary<String, String>() {
{"x-meta-sdk-version", "4.3.11"},
{"x-meta-sdk-version", "5.0.0"},
{"x-meta-sdk-language", "csharp"},
{"x-meta-sdk-provider", "wallee"},
{"x-meta-sdk-language-version", Environment.Version.ToString()}
Expand All @@ -166,7 +166,7 @@ public Object CallApi(
pathParams, contentType);

// set user agent
RestClient.UserAgent = Configuration.UserAgent;
RestClient.Options.UserAgent = Configuration.UserAgent;

InterceptRequest(request);
var response = RestClient.Execute(request);
Expand Down Expand Up @@ -241,9 +241,9 @@ public string ParameterToString(object obj)
/// <param name="response">The HTTP response.</param>
/// <param name="type">Object type.</param>
/// <returns>Object representation of the JSON string.</returns>
public object Deserialize(IRestResponse response, Type type)
public object Deserialize(RestResponse response, Type type)
{
IList<Parameter> headers = response.Headers;
IReadOnlyCollection<HeaderParameter> headers = response.Headers;
if (type == typeof(byte[])) // return byte array
{
return response.RawBytes;
Expand Down Expand Up @@ -342,9 +342,16 @@ public String SelectHeaderContentType(String[] contentTypes)
foreach (var contentType in contentTypes)
{
if (IsJsonMime(contentType.ToLower()))
return contentType;
{
String jsonContentType = contentType;
int index = jsonContentType.IndexOf(";");
if (index >= 0)
{
jsonContentType = jsonContentType.Substring(0, index);
}
return jsonContentType;
}
}

return contentTypes[0]; // use the first content type specified in 'consumes'
}

Expand Down Expand Up @@ -503,11 +510,11 @@ private static bool IsCollection(object value)
public IEnumerable<KeyValuePair<string, string>> AuthenticationHeaders(Method method, string path, List<KeyValuePair<string, string>> queryParams)
{
var headers = new List<KeyValuePair<string, string>>();
var pathWithQueryString = RestClient.BaseUrl.AbsolutePath + path + ToQueryString(queryParams);
var pathWithQueryString = RestClient.Options.BaseUrl.AbsolutePath + path + ToQueryString(queryParams);
var version = "1";
var userID = Configuration.ApplicationUserID;
var timestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
var signature = version + "|" + userID + "|" + timestamp + "|" + method + "|" + pathWithQueryString;
var signature = version + "|" + userID + "|" + timestamp + "|" + method.ToString().ToUpper() + "|" + pathWithQueryString;
headers.Add(new KeyValuePair<string, string>("x-mac-version", version));
headers.Add(new KeyValuePair<string, string>("x-mac-userid", userID));
headers.Add(new KeyValuePair<string, string>("x-mac-timestamp", timestamp.ToString()));
Expand Down Expand Up @@ -550,7 +557,7 @@ private String ToQueryString(List<KeyValuePair<string, string>> queryParams)
/// https://docs.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest.timeout?view=netcore-3.1
/// </summary>
public void ResetTimeout(){
RestClient.Timeout = 100 * 1000;
RestClient.Options.MaxTimeout = 100 * 1000;
}

}
Expand Down
14 changes: 7 additions & 7 deletions src/Wallee/Client/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Configuration : IReadableConfiguration
/// Version of the package.
/// </summary>
/// <value>Version of the package.</value>
public const string Version = "4.3.11";
public const string Version = "5.0.0";

/// <summary>
/// Identifier for ISO 8601 DateTime Format
Expand Down Expand Up @@ -90,7 +90,7 @@ public Configuration(string applicationUserID, string authenticationKey)
}
_authenticationKey = authenticationKey;
_applicationUserID = applicationUserID;
UserAgent = "Wallee/4.3.11/csharp";
UserAgent = "Wallee/5.0.0/csharp";
BasePath = "https://app-wallee.com:443/api";
DefaultHeader = new ConcurrentDictionary<string, string>();
ApiKey = new ConcurrentDictionary<string, string>();
Expand Down Expand Up @@ -128,7 +128,7 @@ public virtual string BasePath {
_basePath = value;
// pass-through to ApiClient if it's set.
if(_apiClient != null) {
_apiClient.RestClient.BaseUrl = new Uri(_basePath);
_apiClient.RestClient.Options.BaseUrl = new Uri(_basePath);
}
}
}
Expand Down Expand Up @@ -166,8 +166,8 @@ public string AuthenticationKey
public virtual int Timeout
{

get { return ApiClient.RestClient.Timeout; }
set { ApiClient.RestClient.Timeout = value; }
get { return ApiClient.RestClient.Options.MaxTimeout; }
set { ApiClient.RestClient.Options.MaxTimeout = value; }
}

/// <summary>
Expand Down Expand Up @@ -338,8 +338,8 @@ public static String ToDebugReport()
String report = "C# SDK (Wallee) Debug Report:\n";
report += " OS: " + System.Environment.OSVersion + "\n";
report += " .NET Framework Version: " + System.Environment.Version + "\n";
report += " Version of the API: 4.3.11\n";
report += " SDK Package Version: 4.3.11\n";
report += " Version of the API: 5.0.0\n";
report += " SDK Package Version: 5.0.0\n";

return report;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Wallee/Client/ExceptionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ namespace Wallee.Client
/// <param name="methodName">Method name</param>
/// <param name="response">Response</param>
/// <returns>Exceptions</returns>
public delegate Exception ExceptionFactory(string methodName, IRestResponse response);
public delegate Exception ExceptionFactory(string methodName, RestResponse response);
}
4 changes: 2 additions & 2 deletions src/Wallee/Model/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ public partial class Account : IEquatable<Account>
/// Gets or Sets State
/// </summary>
[DataMember(Name="state", EmitDefaultValue=false)]
public AccountState? State { get; set; }
public AccountState? State { get; private set; }
/// <summary>
/// The account type defines which role and capabilities it has.
/// </summary>
/// <value>The account type defines which role and capabilities it has.</value>
[DataMember(Name="type", EmitDefaultValue=false)]
public AccountType? Type { get; set; }
public AccountType? Type { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="Account" /> class.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Wallee/Model/Address.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class Address : IEquatable<Address>
/// Gets or Sets Gender
/// </summary>
[DataMember(Name="gender", EmitDefaultValue=false)]
public Gender? Gender { get; set; }
public Gender? Gender { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="Address" /> class.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Wallee/Model/AnalyticsQueryExecution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public partial class AnalyticsQueryExecution : IEquatable<AnalyticsQueryExecuti
/// </summary>
/// <value>The current state of the query execution.</value>
[DataMember(Name="state", EmitDefaultValue=false)]
public AnalyticsQueryExecutionState? State { get; set; }
public AnalyticsQueryExecutionState? State { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="AnalyticsQueryExecution" /> class.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Wallee/Model/BankAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class BankAccount : IEquatable<BankAccount>
/// Gets or Sets State
/// </summary>
[DataMember(Name="state", EmitDefaultValue=false)]
public BankAccountState? State { get; set; }
public BankAccountState? State { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="BankAccount" /> class.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Wallee/Model/BankTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public partial class BankTransaction : IEquatable<BankTransaction>
/// Gets or Sets FlowDirection
/// </summary>
[DataMember(Name="flowDirection", EmitDefaultValue=false)]
public BankTransactionFlowDirection? FlowDirection { get; set; }
public BankTransactionFlowDirection? FlowDirection { get; private set; }
/// <summary>
/// Gets or Sets State
/// </summary>
[DataMember(Name="state", EmitDefaultValue=false)]
public BankTransactionState? State { get; set; }
public BankTransactionState? State { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="BankTransaction" /> class.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Wallee/Model/CardCryptogram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class CardCryptogram : IEquatable<CardCryptogram>
/// Gets or Sets Type
/// </summary>
[DataMember(Name="type", EmitDefaultValue=false)]
public CardCryptogramType? Type { get; set; }
public CardCryptogramType? Type { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="CardCryptogram" /> class.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Wallee/Model/CardholderAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public partial class CardholderAuthentication : IEquatable<CardholderAuthentica
/// Gets or Sets AuthenticationResponse
/// </summary>
[DataMember(Name="authenticationResponse", EmitDefaultValue=false)]
public CardAuthenticationResponse? AuthenticationResponse { get; set; }
public CardAuthenticationResponse? AuthenticationResponse { get; private set; }
/// <summary>
/// Gets or Sets Version
/// </summary>
[DataMember(Name="version", EmitDefaultValue=false)]
public CardAuthenticationVersion? Version { get; set; }
public CardAuthenticationVersion? Version { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="CardholderAuthentication" /> class.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Wallee/Model/Charge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public partial class Charge : TransactionAwareEntity, IEquatable<Charge>
/// Gets or Sets State
/// </summary>
[DataMember(Name="state", EmitDefaultValue=false)]
public ChargeState? State { get; set; }
public ChargeState? State { get; private set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name="type", EmitDefaultValue=false)]
public ChargeType? Type { get; set; }
public ChargeType? Type { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="Charge" /> class.
/// </summary>
Expand Down
10 changes: 5 additions & 5 deletions src/Wallee/Model/ChargeAttempt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,28 @@ public partial class ChargeAttempt : TransactionAwareEntity, IEquatable<ChargeA
/// Gets or Sets CompletionBehavior
/// </summary>
[DataMember(Name="completionBehavior", EmitDefaultValue=false)]
public TransactionCompletionBehavior? CompletionBehavior { get; set; }
public TransactionCompletionBehavior? CompletionBehavior { get; private set; }
/// <summary>
/// The customers presence indicates which kind of customer interaction was used during the charge attempt.
/// </summary>
/// <value>The customers presence indicates which kind of customer interaction was used during the charge attempt.</value>
[DataMember(Name="customersPresence", EmitDefaultValue=false)]
public CustomersPresence? CustomersPresence { get; set; }
public CustomersPresence? CustomersPresence { get; private set; }
/// <summary>
/// Gets or Sets Environment
/// </summary>
[DataMember(Name="environment", EmitDefaultValue=false)]
public ChargeAttemptEnvironment? Environment { get; set; }
public ChargeAttemptEnvironment? Environment { get; private set; }
/// <summary>
/// Gets or Sets State
/// </summary>
[DataMember(Name="state", EmitDefaultValue=false)]
public ChargeAttemptState? State { get; set; }
public ChargeAttemptState? State { get; private set; }
/// <summary>
/// Gets or Sets WalletType
/// </summary>
[DataMember(Name="walletType", EmitDefaultValue=false)]
public WalletType? WalletType { get; set; }
public WalletType? WalletType { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ChargeAttempt" /> class.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Wallee/Model/ChargeFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class ChargeFlow : IEquatable<ChargeFlow>
/// Gets or Sets State
/// </summary>
[DataMember(Name="state", EmitDefaultValue=false)]
public CreationEntityState? State { get; set; }
public CreationEntityState? State { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ChargeFlow" /> class.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Wallee/Model/ChargeFlowLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class ChargeFlowLevel : TransactionAwareEntity, IEquatable<Charg
/// Gets or Sets State
/// </summary>
[DataMember(Name="state", EmitDefaultValue=false)]
public ChargeFlowLevelState? State { get; set; }
public ChargeFlowLevelState? State { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ChargeFlowLevel" /> class.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Wallee/Model/ChargeFlowLevelConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class ChargeFlowLevelConfiguration : IEquatable<ChargeFlowLevelC
/// Gets or Sets State
/// </summary>
[DataMember(Name="state", EmitDefaultValue=false)]
public CreationEntityState? State { get; set; }
public CreationEntityState? State { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ChargeFlowLevelConfiguration" /> class.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Wallee/Model/ClientError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public partial class ClientError : IEquatable<ClientError>
/// </summary>
/// <value>The type of the client error.</value>
[DataMember(Name="type", EmitDefaultValue=false)]
public ClientErrorType? Type { get; set; }
public ClientErrorType? Type { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ClientError" /> class.
/// </summary>
Expand Down
Loading

0 comments on commit d8f8f8b

Please sign in to comment.