Skip to content

Commit dcc1723

Browse files
committed
Merge branch 'release/moov-1.8.25'
2 parents d672596 + 5188c2e commit dcc1723

26 files changed

+394
-72
lines changed

src/NoFrixion.MoneyMoov/Enums/MerchantTokenPermissionsEnum.cs

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,80 +34,90 @@ public enum MerchantTokenPermissionsEnum
3434
/// <summary>
3535
/// Permission to edit a payment request
3636
/// </summary>
37-
EditPaymentRequest = 2,
37+
EditPaymentRequest = 1 << 1,
3838

3939
/// <summary>
4040
/// Permission to delete a payment request
4141
/// </summary>
42-
DeletePaymentRequest = 4,
42+
DeletePaymentRequest = 1 << 2,
4343

4444
/// <summary>
4545
/// Permission to create a rule
4646
/// </summary>
47-
CreateRule = 8,
47+
CreateRule = 1 << 3,
4848

4949
/// <summary>
5050
/// Permission to edit a rule
5151
/// </summary>
52-
EditRule = 16,
52+
EditRule = 1 << 4,
5353

5454
/// <summary>
5555
/// Permission to delete a rule
5656
/// </summary>
57-
DeleteRule = 32,
57+
DeleteRule = 1 << 5,
5858

5959
/// <summary>
6060
/// Permission to create a payout
6161
/// </summary>
62-
CreatePayout = 64,
62+
CreatePayout = 1 << 6,
6363

6464
/// <summary>
6565
/// Permission to edit a payout
6666
/// </summary>
67-
EditPayout = 128,
67+
EditPayout = 1 << 7,
6868

6969
/// <summary>
7070
/// Permission to delete a payout
7171
/// </summary>
72-
DeletePayout = 256,
72+
DeletePayout = 1 << 8,
7373

7474
/// <summary>
7575
/// Permission to create a report.
7676
/// </summary>
77-
CreateReport = 512,
77+
CreateReport = 1 << 9,
7878

7979
/// <summary>
8080
/// Permission to edit, retrieve and initiate a report.
8181
/// </summary>
82-
EditReport = 1024,
82+
EditReport = 1 << 10,
8383

8484
/// <summary>
8585
/// Permission to delete a report.
8686
/// </summary>
87-
DeleteReport = 2048,
87+
DeleteReport = 1 << 11,
8888

8989
/// <summary>
9090
/// Permission to execute and get report results.
9191
/// </summary>
92-
ExecuteReport = 4096,
92+
ExecuteReport = 1 << 12,
9393

9494
/// <summary>
9595
/// Permission to create a new payment account.
9696
/// </summary>
97-
CreatePaymentAccount = 8192,
97+
CreatePaymentAccount = 1 << 13,
9898

9999
/// <summary>
100100
/// Permission to edit details on a payment account.
101101
/// </summary>
102-
EditPaymentAccount = 16384,
102+
EditPaymentAccount = 1 << 14,
103103

104104
/// <summary>
105105
/// Permission to create and submit a payout from a trusted source.
106106
/// </summary>
107-
TrustedSubmitPayout = 32768,
107+
TrustedSubmitPayout = 1 << 15,
108108

109109
/// <summary>
110-
/// Permission to perfrom open banking account information actions.
110+
/// Permission to perform open banking account information actions.
111111
/// </summary>
112-
OpenBankingAccountInformation = 65536
112+
OpenBankingAccountInformation = 1 << 16,
113+
114+
/// <summary>
115+
/// Permission to create a direct debit mandate.
116+
/// </summary>
117+
CreateDirectDebitMandate = 1 << 17,
118+
119+
/// <summary>
120+
/// Permission to submit a direct debit payment attempt.
121+
/// </summary>
122+
SubmitDirectDebitPayment = 1 << 18
113123
}

src/NoFrixion.MoneyMoov/Enums/PayrunEventTypeEnum.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,7 @@ public enum PayrunEventTypeEnum
4040

4141
Archived = 10,
4242

43-
Unarchived = 11
43+
Unarchived = 11,
44+
45+
Cancelled = 12,
4446
}

src/NoFrixion.MoneyMoov/Enums/WebhookResourceTypesEnum.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ public enum WebhookResourceTypesEnum
6767
/// <summary>
6868
/// Will trigger notifications for report, including account statement, related events.
6969
/// </summary>
70-
Report = 64
70+
Report = 64,
71+
72+
/// <summary>
73+
/// Will trigger notifications for tribe load event
74+
/// </summary>
75+
TribeLoad = 128,
7176
}
7277

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
//-----------------------------------------------------------------------------
2+
// Filename: GuidExtensions.cs
3+
//
4+
// Description: Contains extension methods for Guid types:
5+
//
6+
// Author(s):
7+
// Aaron Clauson ([email protected])
8+
//
9+
// History:
10+
// 15 Oct 2024 Aaron Clauson Created, Carne, Wexford, Ireland.
11+
//
12+
// License:
13+
// Proprietary NoFrixion.
14+
//-----------------------------------------------------------------------------
15+
16+
namespace NoFrixion.MoneyMoov;
17+
18+
public static class EnumExtensions
19+
{
20+
/// <summary>
21+
/// This method converts an Enum with the Flags attribute to a list of Enums.
22+
/// </summary>
23+
public static List<T> ToList<T>(this T flags) where T : Enum
24+
{
25+
if (!typeof(T).IsDefined(typeof(FlagsAttribute), false))
26+
{
27+
throw new ArgumentException("The type parameter T must have the Flags attribute.", nameof(flags));
28+
}
29+
30+
// Check if the enum underlying type is ulong
31+
var underlyingType = Enum.GetUnderlyingType(typeof(T));
32+
33+
if (underlyingType == typeof(ulong))
34+
{
35+
return Enum.GetValues(typeof(T))
36+
.Cast<T>()
37+
.Where(value => flags.HasFlag(value) && Convert.ToUInt64(value) != 0) // Exclude None or 0
38+
.ToList();
39+
}
40+
else
41+
{
42+
return Enum.GetValues(typeof(T))
43+
.Cast<T>()
44+
.Where(value => flags.HasFlag(value) && Convert.ToInt32(value) != 0) // Exclude None or 0
45+
.ToList();
46+
}
47+
}
48+
49+
/// <summary>
50+
/// This method converts list of flag enum values to a single flag enum.
51+
/// </summary>
52+
public static T ToFlagEnum<T>(this IEnumerable<T> enumValues) where T : Enum
53+
{
54+
if (!typeof(T).IsDefined(typeof(FlagsAttribute), false))
55+
{
56+
throw new ArgumentException("The type parameter T must have the Flags attribute.", nameof(enumValues));
57+
}
58+
59+
// Check if the enum underlying type is ulong
60+
var underlyingType = Enum.GetUnderlyingType(typeof(T));
61+
62+
if (underlyingType == typeof(ulong))
63+
{
64+
ulong result = 0UL;
65+
66+
foreach (var value in enumValues)
67+
{
68+
result |= Convert.ToUInt64(value);
69+
}
70+
71+
return (T)Enum.ToObject(typeof(T), result);
72+
}
73+
else
74+
{
75+
int result = 0;
76+
77+
foreach (var value in enumValues)
78+
{
79+
result |= Convert.ToInt32(value);
80+
}
81+
82+
return (T)Enum.ToObject(typeof(T), result);
83+
}
84+
}
85+
}

src/NoFrixion.MoneyMoov/Extensions/PaymentRequestExtensions.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,17 +410,19 @@ PaymentRequestEventTypesEnum.direct_debit_failed or
410410
PaymentMethod = PaymentMethodTypeEnum.directDebit,
411411
Currency = createEvent.Currency,
412412
AttemptedAmount = createEvent.Amount,
413-
PaymentProcessor = createEvent.PaymentProcessorName
413+
PaymentProcessor = createEvent.PaymentProcessorName,
414+
AuthorisedAt = createEvent.Inserted,
415+
AuthorisedAmount = createEvent.Amount
414416
};
415417

416418
if (attempt.Any(x =>
417419
x.EventType is PaymentRequestEventTypesEnum.direct_debit_paid))
418420
{
419421
var paidEvent = attempt.First(x =>
420422
x.EventType is PaymentRequestEventTypesEnum.direct_debit_paid);
421-
422-
paymentAttempt.AuthorisedAt = paidEvent.Inserted;
423-
paymentAttempt.AuthorisedAmount = paidEvent.Amount;
423+
424+
paymentAttempt.SettledAt = paidEvent.Inserted;
425+
paymentAttempt.SettledAmount = paidEvent.Amount;
424426
}
425427
else if (attempt.Any(x =>
426428
x.EventType is PaymentRequestEventTypesEnum.direct_debit_failed))

src/NoFrixion.MoneyMoov/JsonConverters/NumericConverter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// MIT.
1515
//-----------------------------------------------------------------------------
1616

17-
using LanguageExt;
1817
using System.ComponentModel;
1918
using System.Text.Json;
2019
using System.Text.Json.Serialization;

src/NoFrixion.MoneyMoov/Models/Mandates/Mandate.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,14 @@ public class Mandate
112112
/// <summary>
113113
/// Currency of this mandate.
114114
/// </summary>
115-
public CurrencyTypeEnum Currency { get; set; }
116-
115+
public CurrencyTypeEnum Currency { get; set; }
116+
117117
/// <summary>
118-
/// Amount of this mandate.
118+
/// This is an optional field that with mandates created via Account Information Services can be
119+
/// used to do a balance check on the payer's account. We don't currenlty support the AIS workflow.
119120
/// </summary>
121+
[System.Text.Json.Serialization.JsonIgnore]
122+
[Newtonsoft.Json.JsonIgnore]
120123
public decimal Amount { get; set; }
121124

122125
/// <summary>

src/NoFrixion.MoneyMoov/Models/Mandates/MandateCreate.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,11 @@ public class MandateCreate
124124
public CurrencyTypeEnum Currency { get; set; }
125125

126126
/// <summary>
127-
/// Amount of the mandate.
127+
/// This is an optional field that with mandates created via Account Information Services can be
128+
/// used to do a balance check on the payer's account. We don't currenlty support the AIS workflow.
128129
/// </summary>
129-
[Required(ErrorMessage = "Please, specify an amount.")]
130-
[Range(0.00001, double.MaxValue, ErrorMessage = "Minimum value of 0.00001 is required for Amount")]
130+
[System.Text.Json.Serialization.JsonIgnore]
131+
[Newtonsoft.Json.JsonIgnore]
131132
public decimal Amount { get; set; }
132133

133134
/// <summary>

src/NoFrixion.MoneyMoov/Models/Merchant/Merchant.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,19 @@ public class Merchant
101101
/// For internal use only.
102102
/// </summary>
103103
public string? ModulrCustomerID { get; set; }
104-
104+
105105
/// <summary>
106106
/// The payment methods that are configured and supported for this merchant.
107107
/// Returned as a comma-separated list of PaymentMethodTypeEnum values.
108108
/// </summary>
109+
[Obsolete("Please usse SupportedPaymentMethodsList instead.")]
109110
public PaymentMethodTypeEnum SupportedPaymentMethods { get; set; }
110111

112+
/// <summary>
113+
/// The payment methods that are configured and supported for this merchant.
114+
/// </summary>
115+
public List<PaymentMethodTypeEnum> SupportedPaymentMethodsList { get; set; } = new List<PaymentMethodTypeEnum>();
116+
111117
/// <summary>
112118
/// The role of the identity that loaded the merchant record.
113119
/// </summary>

src/NoFrixion.MoneyMoov/Models/PaymentRequests/IPaymentRequest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ public interface IPaymentRequest
2626

2727
public string? OrderID { get; set; }
2828

29-
public PaymentMethodTypeEnum PaymentMethodTypes { get; set; }
29+
[Obsolete("This field has been deprecated. Please use PaymentMethods instead.")]
30+
public PaymentMethodTypeEnum PaymentMethodTypes { get; }
31+
32+
public List<PaymentMethodTypeEnum> PaymentMethods { get; set; }
3033

3134
public string? Description { get; set; }
3235

0 commit comments

Comments
 (0)