Skip to content

Commit d8f8f8b

Browse files
committed
Release 5.0.0
1 parent 144204e commit d8f8f8b

File tree

207 files changed

+3536
-6324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+3536
-6324
lines changed

.github/workflows/publishing.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
nuget restore Wallee.sln
2525
nuget install NUnit.Console -Version 3.11.1 -OutputDirectory testrunner
2626
msbuild /t:restore Wallee.sln && msbuild Wallee.sln /t:build /p:Configuration=Release
27-
mono testrunner/NUnit.ConsoleRunner.3.11.1/tools/nunit3-console.exe ./src/Wallee.Test/bin/Release/net452/Wallee.Test.dll --inprocess
27+
mono testrunner/NUnit.ConsoleRunner.3.11.1/tools/nunit3-console.exe ./src/Wallee.Test/bin/Release/net5.0/Wallee.Test.dll --inprocess
2828
2929
publish:
3030
needs: build

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ The wallee C# library wraps around the wallee API. This library facilitates your
1010

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

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

@@ -26,19 +26,18 @@ Install-Package Newtonsoft.Json
2626
Install-Package JsonSubTypes
2727
```
2828

29-
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)
3029

3130
<a name="installation"></a>
3231
## Installation
3332
```
3433
# Package Manager
35-
Install-Package Wallee -Version 4.3.11
34+
Install-Package Wallee -Version 5.0.0
3635
# .NET CLI
37-
dotnet add package Wallee --version 4.3.11
36+
dotnet add package Wallee --version 5.0.0
3837
# Paket CLI
39-
paket add Wallee --version 4.3.11
38+
paket add Wallee --version 5.0.0
4039
# PackageReference
41-
<PackageReference Include="Wallee" Version="4.3.11" />
40+
<PackageReference Include="Wallee" Version="5.0.0" />
4241
```
4342

4443
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:

src/Wallee.Test/Wallee.Test.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks>
44
</PropertyGroup>
55
<PropertyGroup>
66
<AssemblyName>Wallee.Test</AssemblyName>
@@ -19,14 +19,15 @@
1919

2020
<ItemGroup>
2121
<PackageReference Include="NUnit" Version="3.9.0"/>
22-
<PackageReference Include="RestSharp" Version="[106.2.1, 107)"/>
22+
<PackageReference Include="RestSharp" Version="108.0.1"/>
2323
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
2424
<PackageReference Include="JsonSubTypes" Version="1.6.0"/>
2525
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
2626
</ItemGroup>
2727

2828
<ItemGroup>
2929
<Reference Include="System"/>
30+
<Reference Include="System.Net.Http"/>
3031
<Reference Include="System.Core"/>
3132
<Reference Include="System.Xml.Linq"/>
3233
<Reference Include="System.Data.DataSetExtensions"/>

src/Wallee/Client/ApiClient.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ public partial class ApiClient
2727
/// Allows for extending request processing for <see cref="ApiClient"/> generated code.
2828
/// </summary>
2929
/// <param name="request">The RestSharp request object</param>
30-
partial void InterceptRequest(IRestRequest request);
30+
partial void InterceptRequest(RestRequest request);
3131

3232
/// <summary>
3333
/// Allows for extending response processing for <see cref="ApiClient"/> generated code.
3434
/// </summary>
3535
/// <param name="request">The RestSharp request object</param>
3636
/// <param name="response">The RestSharp response object</param>
37-
partial void InterceptResponse(IRestRequest request, IRestResponse response);
37+
partial void InterceptResponse(RestRequest request, RestResponse response);
3838

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

129129
if (postBody != null) // http body (model or byte[]) parameter
130130
{
131-
request.AddParameter(contentType, postBody, ParameterType.RequestBody);
131+
request.AddBody(postBody, contentType);
132132
}
133133

134134
return request;
@@ -155,7 +155,7 @@ public Object CallApi(
155155
{
156156

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

168168
// set user agent
169-
RestClient.UserAgent = Configuration.UserAgent;
169+
RestClient.Options.UserAgent = Configuration.UserAgent;
170170

171171
InterceptRequest(request);
172172
var response = RestClient.Execute(request);
@@ -241,9 +241,9 @@ public string ParameterToString(object obj)
241241
/// <param name="response">The HTTP response.</param>
242242
/// <param name="type">Object type.</param>
243243
/// <returns>Object representation of the JSON string.</returns>
244-
public object Deserialize(IRestResponse response, Type type)
244+
public object Deserialize(RestResponse response, Type type)
245245
{
246-
IList<Parameter> headers = response.Headers;
246+
IReadOnlyCollection<HeaderParameter> headers = response.Headers;
247247
if (type == typeof(byte[])) // return byte array
248248
{
249249
return response.RawBytes;
@@ -342,9 +342,16 @@ public String SelectHeaderContentType(String[] contentTypes)
342342
foreach (var contentType in contentTypes)
343343
{
344344
if (IsJsonMime(contentType.ToLower()))
345-
return contentType;
345+
{
346+
String jsonContentType = contentType;
347+
int index = jsonContentType.IndexOf(";");
348+
if (index >= 0)
349+
{
350+
jsonContentType = jsonContentType.Substring(0, index);
351+
}
352+
return jsonContentType;
353+
}
346354
}
347-
348355
return contentTypes[0]; // use the first content type specified in 'consumes'
349356
}
350357

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

556563
}

src/Wallee/Client/Configuration.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class Configuration : IReadableConfiguration
1919
/// Version of the package.
2020
/// </summary>
2121
/// <value>Version of the package.</value>
22-
public const string Version = "4.3.11";
22+
public const string Version = "5.0.0";
2323

2424
/// <summary>
2525
/// Identifier for ISO 8601 DateTime Format
@@ -90,7 +90,7 @@ public Configuration(string applicationUserID, string authenticationKey)
9090
}
9191
_authenticationKey = authenticationKey;
9292
_applicationUserID = applicationUserID;
93-
UserAgent = "Wallee/4.3.11/csharp";
93+
UserAgent = "Wallee/5.0.0/csharp";
9494
BasePath = "https://app-wallee.com:443/api";
9595
DefaultHeader = new ConcurrentDictionary<string, string>();
9696
ApiKey = new ConcurrentDictionary<string, string>();
@@ -128,7 +128,7 @@ public virtual string BasePath {
128128
_basePath = value;
129129
// pass-through to ApiClient if it's set.
130130
if(_apiClient != null) {
131-
_apiClient.RestClient.BaseUrl = new Uri(_basePath);
131+
_apiClient.RestClient.Options.BaseUrl = new Uri(_basePath);
132132
}
133133
}
134134
}
@@ -166,8 +166,8 @@ public string AuthenticationKey
166166
public virtual int Timeout
167167
{
168168

169-
get { return ApiClient.RestClient.Timeout; }
170-
set { ApiClient.RestClient.Timeout = value; }
169+
get { return ApiClient.RestClient.Options.MaxTimeout; }
170+
set { ApiClient.RestClient.Options.MaxTimeout = value; }
171171
}
172172

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

344344
return report;
345345
}

src/Wallee/Client/ExceptionFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ namespace Wallee.Client
2828
/// <param name="methodName">Method name</param>
2929
/// <param name="response">Response</param>
3030
/// <returns>Exceptions</returns>
31-
public delegate Exception ExceptionFactory(string methodName, IRestResponse response);
31+
public delegate Exception ExceptionFactory(string methodName, RestResponse response);
3232
}

src/Wallee/Model/Account.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ public partial class Account : IEquatable<Account>
2424
/// Gets or Sets State
2525
/// </summary>
2626
[DataMember(Name="state", EmitDefaultValue=false)]
27-
public AccountState? State { get; set; }
27+
public AccountState? State { get; private set; }
2828
/// <summary>
2929
/// The account type defines which role and capabilities it has.
3030
/// </summary>
3131
/// <value>The account type defines which role and capabilities it has.</value>
3232
[DataMember(Name="type", EmitDefaultValue=false)]
33-
public AccountType? Type { get; set; }
33+
public AccountType? Type { get; private set; }
3434
/// <summary>
3535
/// Initializes a new instance of the <see cref="Account" /> class.
3636
/// </summary>

src/Wallee/Model/Address.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public partial class Address : IEquatable<Address>
2424
/// Gets or Sets Gender
2525
/// </summary>
2626
[DataMember(Name="gender", EmitDefaultValue=false)]
27-
public Gender? Gender { get; set; }
27+
public Gender? Gender { get; private set; }
2828
/// <summary>
2929
/// Initializes a new instance of the <see cref="Address" /> class.
3030
/// </summary>

src/Wallee/Model/AnalyticsQueryExecution.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public partial class AnalyticsQueryExecution : IEquatable<AnalyticsQueryExecuti
2525
/// </summary>
2626
/// <value>The current state of the query execution.</value>
2727
[DataMember(Name="state", EmitDefaultValue=false)]
28-
public AnalyticsQueryExecutionState? State { get; set; }
28+
public AnalyticsQueryExecutionState? State { get; private set; }
2929
/// <summary>
3030
/// Initializes a new instance of the <see cref="AnalyticsQueryExecution" /> class.
3131
/// </summary>

src/Wallee/Model/BankAccount.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public partial class BankAccount : IEquatable<BankAccount>
2424
/// Gets or Sets State
2525
/// </summary>
2626
[DataMember(Name="state", EmitDefaultValue=false)]
27-
public BankAccountState? State { get; set; }
27+
public BankAccountState? State { get; private set; }
2828
/// <summary>
2929
/// Initializes a new instance of the <see cref="BankAccount" /> class.
3030
/// </summary>

0 commit comments

Comments
 (0)