-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
111 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//----------------------------------------------------------------------------- | ||
// Filename: PayrunConstants.cs | ||
// | ||
// Description: Constants for Payrun. | ||
// | ||
// Author(s): | ||
// Saurav Maiti ([email protected]) | ||
// | ||
// History: | ||
// 23 Oct 2024 Saurav Maiti Created, Harcourt St, Dublin, Ireland. | ||
// | ||
// License: | ||
// MIT | ||
//----------------------------------------------------------------------------- | ||
|
||
namespace NoFrixion.MoneyMoov.Constants; | ||
|
||
public static class PayrunConstants | ||
{ | ||
public const string REMMITANCE_EMAIL_ADDRESSES_ERROR_MESSAGE = | ||
"One or more of the remittance email addresses are invalid. Addresses can be separated by a comma, semi-colon or space."; | ||
} |
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,42 @@ | ||
//----------------------------------------------------------------------------- | ||
// Filename: CurrencyExtensions.cs | ||
// | ||
// Description: Contains extension methods for the Currency enum. | ||
// | ||
// Author(s): | ||
// Aaron Clauson ([email protected]) | ||
// | ||
// History: | ||
// 23 Oct 2024 Aaron Clauson Created, Carne, Wexford, Ireland. | ||
// | ||
// License: | ||
// MIT | ||
//----------------------------------------------------------------------------- | ||
|
||
namespace NoFrixion.MoneyMoov; | ||
|
||
public static class CurrencyExtensions | ||
{ | ||
public static string GetCurrencySymbol(this CurrencyTypeEnum currency) => | ||
currency switch | ||
{ | ||
CurrencyTypeEnum.BTC => "₿", | ||
CurrencyTypeEnum.GBP => "£", | ||
CurrencyTypeEnum.EUR => "€", | ||
_ => "€" | ||
}; | ||
|
||
public static bool IsFiat(this CurrencyTypeEnum currency) => | ||
currency switch | ||
{ | ||
CurrencyTypeEnum.BTC => false, | ||
_ => true | ||
}; | ||
|
||
public static int GetDecimalPlaces(this CurrencyTypeEnum currency) => | ||
currency switch | ||
{ | ||
CurrencyTypeEnum.BTC => PaymentsConstants.BITCOIN_ROUNDING_DECIMAL_PLACES, | ||
_ => PaymentsConstants.FIAT_ROUNDING_DECIMAL_PLACES | ||
}; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//----------------------------------------------------------------------------- | ||
// Filename: NonceHelper.cs | ||
// | ||
// Description: Helper functions for dealing with nonces. | ||
// | ||
// Author(s): | ||
// Aaron Clauson ([email protected]) | ||
// | ||
// History: | ||
// 23 Oct 2024 Aaron Clauson Created, Carne, Wexford, Ireland. | ||
// | ||
// License: | ||
// MIT. | ||
//----------------------------------------------------------------------------- | ||
|
||
using System.Security.Cryptography; | ||
|
||
namespace NoFrixion.MoneyMoov; | ||
|
||
public static class NonceHelper | ||
{ | ||
public static string GenerateRandomNonce() | ||
{ | ||
var nonce = new byte[64]; | ||
var random = RandomNumberGenerator.Create(); | ||
random.GetBytes(nonce); | ||
|
||
return Convert.ToBase64String(nonce); | ||
} | ||
} |