-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updated tests * more fixes * updated github workflow config * added mono install to github workflow * added sleep to test --------- Co-authored-by: Iulian Masar <[email protected]>
- Loading branch information
Showing
12 changed files
with
117 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using MangoPay.SDK.Core.Enumerations; | ||
using MangoPay.SDK.Entities; | ||
using MangoPay.SDK.Entities.POST; | ||
using NUnit.Framework; | ||
|
||
namespace MangoPay.SDK.Tests | ||
|
@@ -14,7 +17,21 @@ public async Task Test_RateLimits_Retreive() | |
|
||
try | ||
{ | ||
await this.GetJohn(); | ||
var user = new UserNaturalOwnerPostDTO | ||
{ | ||
Email = "[email protected]", | ||
FirstName = "John", | ||
LastName = "Doe", | ||
Birthday = new DateTime(1975, 12, 21, 0, 0, 0), | ||
Nationality = CountryIso.FR, | ||
CountryOfResidence = CountryIso.FR, | ||
Occupation = "programmer", | ||
IncomeRange = 3, | ||
Address = new Address { AddressLine1 = "Address line 1", AddressLine2 = "Address line 2", City = "City", Country = CountryIso.PL, PostalCode = "11222", Region = "Region" } | ||
}; | ||
|
||
await this.Api.Users.CreateOwnerAsync(user); | ||
|
||
Assert.IsNotNull(Api.LastRequestInfo); | ||
Assert.IsNotNull(Api.LastRequestInfo.RateLimitingCallsRemaining); | ||
Assert.IsNotNull(Api.LastRequestInfo.RateLimitingTimeTillReset); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using MangoPay.SDK.Entities; | ||
using Newtonsoft.Json; | ||
|
||
namespace MangoPay.SDK.Core.Serializers | ||
{ | ||
/// <summary> | ||
/// Write 'amount' as NULL if the value is 0 | ||
/// </summary> | ||
public class MoneyConverter : JsonConverter<Money> | ||
{ | ||
public override void WriteJson(JsonWriter writer, Money value, JsonSerializer serializer) | ||
{ | ||
if (value == null) | ||
{ | ||
writer.WriteNull(); | ||
return; | ||
} | ||
|
||
writer.WriteStartObject(); | ||
|
||
writer.WritePropertyName("Currency"); | ||
serializer.Serialize(writer, value.Currency.ToString()); | ||
|
||
writer.WritePropertyName("Amount"); | ||
if (value.Amount == 0) | ||
{ | ||
writer.WriteNull(); | ||
} | ||
else | ||
{ | ||
writer.WriteValue(value.Amount); | ||
} | ||
|
||
writer.WriteEndObject(); | ||
} | ||
|
||
public override Money ReadJson(JsonReader reader, Type objectType, Money existingValue, bool hasExistingValue, JsonSerializer serializer) | ||
{ | ||
var obj = serializer.Deserialize<dynamic>(reader); | ||
return new Money | ||
{ | ||
Currency = obj.Currency, | ||
Amount = obj.Amount ?? 0 | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters