-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename InstantConversion to Conversions
added quote endpoints
- Loading branch information
1 parent
7b431ec
commit 841dace
Showing
10 changed files
with
157 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Threading.Tasks; | ||
using MangoPay.SDK.Core.Enumerations; | ||
using MangoPay.SDK.Entities.GET; | ||
using MangoPay.SDK.Entities.POST; | ||
|
||
namespace MangoPay.SDK.Core.APIs | ||
{ | ||
public class ApiConversions : ApiBase | ||
{ | ||
public ApiConversions(MangoPayApi root) : base(root) | ||
{ | ||
} | ||
|
||
public async Task<ConversionRateDTO> GetConversionRate(string debitedCurrency, string creditedCurrency) | ||
{ | ||
return await this.GetObjectAsync<ConversionRateDTO>(MethodKey.GetConversionRate, | ||
entitiesId: new[] { debitedCurrency, creditedCurrency }); | ||
} | ||
|
||
public async Task<ConversionDTO> CreateInstantConversion(ConversionPostDTO conversion, | ||
string idempotentKey = null) | ||
{ | ||
return await | ||
this.CreateObjectAsync<ConversionDTO, ConversionPostDTO>(MethodKey.CreateInstantConversion, | ||
conversion, idempotentKey); | ||
} | ||
|
||
public async Task<ConversionDTO> GetInstantConversion(string id) | ||
{ | ||
return await this.GetObjectAsync<ConversionDTO>(MethodKey.GetInstantConversion, | ||
entitiesId: id); | ||
} | ||
|
||
public async Task<ConversionQuoteDTO> CreateConversionQuote(ConversionQuotePostDTO conversionQuote, | ||
string idempotentKey = null) | ||
{ | ||
return await this.CreateObjectAsync<ConversionQuoteDTO, ConversionQuotePostDTO>( | ||
MethodKey.CreateConversionQuote, | ||
conversionQuote, | ||
idempotentKey); | ||
} | ||
|
||
public async Task<ConversionQuoteDTO> GetConversionQuote(string id) | ||
{ | ||
return await this.GetObjectAsync<ConversionQuoteDTO>(MethodKey.GetConversionQuote, entitiesId: id); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
using System; | ||
using MangoPay.SDK.Core.Enumerations; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace MangoPay.SDK.Entities.GET | ||
{ | ||
public class ConversionQuoteDTO : EntityBase | ||
{ | ||
/// <summary>The date and time at which the quote expires</summary> | ||
[JsonConverter(typeof(Core.UnixDateTimeConverter))] | ||
public DateTime ExpirationDate { get; set; } | ||
|
||
/// <summary>The status of the transaction.</summary> | ||
public string Status { get; set; } | ||
|
||
/// <summary>The sell funds</summary> | ||
public Money DebitedFunds { get; set; } | ||
|
||
/// <summary>The buy funds</summary> | ||
public Money CreditedFunds { get; set; } | ||
|
||
/// <summary>Real time indicative market rate of a specific currency pair</summary> | ||
public ConversionRateDTO ConversionRateResponse { get; set; } | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...Entities/POST/InstantConversionPostDTO.cs → ...ay.SDK/Entities/POST/ConversionPostDTO.cs
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,27 @@ | ||
namespace MangoPay.SDK.Entities.POST | ||
{ | ||
public class ConversionQuotePostDTO : EntityPostBase | ||
{ | ||
public ConversionQuotePostDTO( | ||
Money debitedFunds, | ||
Money creditedFunds, | ||
int duration, | ||
string tag | ||
) | ||
{ | ||
DebitedFunds = debitedFunds; | ||
CreditedFunds = creditedFunds; | ||
Duration = duration; | ||
Tag = tag; | ||
} | ||
|
||
/// <summary>The sell funds</summary> | ||
public Money DebitedFunds { get; set; } | ||
|
||
/// <summary>The buy funds</summary> | ||
public Money CreditedFunds { get; set; } | ||
|
||
/// <summary>The time in seconds during which the quote is active and can be used for conversions.</summary> | ||
public int Duration { get; set; } | ||
} | ||
} |
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