Skip to content

Commit

Permalink
Replace init with set in all models (#363)
Browse files Browse the repository at this point in the history
* Use { get; set; } everywhere instead of { get; init; } so we can continue to support lower C# language versions
  • Loading branch information
Viincenttt committed Jun 4, 2024
1 parent 3cf73a8 commit d7800b6
Show file tree
Hide file tree
Showing 130 changed files with 567 additions and 568 deletions.
4 changes: 2 additions & 2 deletions src/Mollie.Api/Models/Amount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public record Amount {
/// <summary>
/// An ISO 4217 currency code. The currencies supported depend on the payment methods that are enabled on your account.
/// </summary>
public required string Currency { get; init; }
public required string Currency { get; set; }

/// <summary>
/// An ISO 4217 currency code. The currencies supported depend on the payment methods that are enabled on your account.
/// </summary>
public required string Value { get; init; }
public required string Value { get; set; }

[JsonConstructor]
[SetsRequiredMembers]
Expand Down
6 changes: 3 additions & 3 deletions src/Mollie.Api/Models/ApplicationFee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ public record ApplicationFee {
/// <summary>
/// The amount in EURO that the app wants to charge, e.g. 10.00 if the app would want to charge €10.00.
/// </summary>
public required Amount Amount { get; init; }
public required Amount Amount { get; set; }

/// <summary>
/// The description of the application fee. This will appear on settlement reports to the merchant and to you.
/// </summary>
public required string Description { get; init; }
public required string Description { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Mollie.Api.Models.Balance.Response.BalanceReport {
public record BalanceReportAmount {
public required Amount Amount { get; init; }
public required Amount Amount { get; set; }

public override string ToString() {
return Amount.ToString();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace Mollie.Api.Models.Balance.Response.BalanceReport {
public record BalanceReportAmountWithSubtotals : BalanceReportAmount {
public required IEnumerable<BalanceReportSubtotals> Subtotals { get; init; }
public required IEnumerable<BalanceReportSubtotals> Subtotals { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ public record BalanceReportLinks {
/// <summary>
/// The API resource URL of the balance report itself.
/// </summary>
public required UrlObjectLink<BalanceReportResponse> Self { get; init; }
public required UrlObjectLink<BalanceReportResponse> Self { get; set; }

/// <summary>
/// The URL to the order retrieval endpoint documentation.
/// </summary>
public required UrlLink Documentation { get; init; }
public required UrlLink Documentation { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ public record BalanceReportResponse {
/// <summary>
/// Indicates the response contains a balance report object. Will always contain balance-report for this endpoint.
/// </summary>
public required string Resource { get; init; }
public required string Resource { get; set; }

/// <summary>
/// The ID of a Balance this report is generated for.
/// </summary>
public required string BalanceId { get; init; }
public required string BalanceId { get; set; }

/// <summary>
/// The time zone used for the from and until parameters. Currently only time zone Europe/Amsterdam is supported.
/// </summary>
public required string TimeZone { get; init; }
public required string TimeZone { get; set; }

/// <summary>
/// The start date of the report, in YYYY-MM-DD format. The from date is ‘inclusive’, and in Central European Time.
/// This means a report with for example from: 2020-01-01 will include movements of 2020-01-01 0:00:00 CET and onwards.
/// </summary>
public required DateTime From { get; init; }
public required DateTime From { get; set; }

/// <summary>
/// The end date of the report, in YYYY-MM-DD format. The until date is ‘exclusive’, and in Central European Time.
/// This means a report with for example until: 2020-02-01 will include movements up until 2020-01-31 23:59:59 CET.
/// </summary>
public required DateTime Until { get; init; }
public required DateTime Until { get; set; }

/// <summary>
/// You can retrieve reports in two different formats. With the status-balances format, transactions are grouped by status
/// (e.g. pending, available), then by direction of movement (e.g. moved from pending to available), then by transaction type,
Expand All @@ -41,12 +41,12 @@ public record BalanceReportResponse {
/// Both reporting formats will always contain opening and closing amounts that correspond to the start and end dates of the report.
/// Possible values: status-balances transaction-categories
/// </summary>
public required string Grouping { get; init; }
public required string Grouping { get; set; }

/// <summary>
/// An object with several URL objects relevant to the balance report.
/// </summary>
[JsonProperty("_links")]
public required BalanceReportLinks Links { get; init; }
public required BalanceReportLinks Links { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace Mollie.Api.Models.Balance.Response.BalanceReport {
public record BalanceReportSubtotals {
public string? TransactionType { get; set; }
public string? Method { get; set; }
public string? PrepaymentPartType { get; init; }
public required string FeeType { get; init; }
public required int Count { get; init; }
public required Amount Amount { get; init; }
public string? PrepaymentPartType { get; set; }
public required string FeeType { get; set; }
public required int Count { get; set; }
public required Amount Amount { get; set; }
public IEnumerable<BalanceReportSubtotals>? Subtotals { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace Mollie.Api.Models.Balance.Response.BalanceReport.Specific.StatusBalance {
public record StatusBalanceAvailableBalance {
public required BalanceReportAmount Open { get; init; }
public required BalanceReportAmount Close { get; init; }
public required BalanceReportAmountWithSubtotals MovedFromPending { get; init; }
public required BalanceReportAmountWithSubtotals ImmediatelyAvailable { get; init; }
public required BalanceReportAmount Open { get; set; }
public required BalanceReportAmount Close { get; set; }
public required BalanceReportAmountWithSubtotals MovedFromPending { get; set; }
public required BalanceReportAmountWithSubtotals ImmediatelyAvailable { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace Mollie.Api.Models.Balance.Response.BalanceReport.Specific.StatusBalance {
public record StatusBalanceReportResponse : BalanceReportResponse {
public required StatusBalancesTotal Totals { get; init; }
public required StatusBalancesTotal Totals { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace Mollie.Api.Models.Balance.Response.BalanceReport.Specific.StatusBalance {
public record StatusBalancesPendingBalance {
public required BalanceReportAmount Open { get; init; }
public required BalanceReportAmount Close { get; init; }
public required BalanceReportAmountWithSubtotals Pending { get; init; }
public required BalanceReportAmountWithSubtotals MovedToAvailable { get; init; }
public required BalanceReportAmount Open { get; set; }
public required BalanceReportAmount Close { get; set; }
public required BalanceReportAmountWithSubtotals Pending { get; set; }
public required BalanceReportAmountWithSubtotals MovedToAvailable { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Mollie.Api.Models.Balance.Response.BalanceReport.Specific.StatusBalance {
public record StatusBalancesTotal {
public required StatusBalancesPendingBalance PendingBalance { get; init; }
public required StatusBalanceAvailableBalance AvailableBalance { get; init; }
public required StatusBalancesPendingBalance PendingBalance { get; set; }
public required StatusBalanceAvailableBalance AvailableBalance { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
namespace Mollie.Api.Models.Balance.Response.BalanceReport.Specific.TransactionCategories {
public record TransactionCategoriesReportResponse : BalanceReportResponse {
public required TransactionCategoriesTotal Totals { get; init; }
public required TransactionCategoriesTotal Totals { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Mollie.Api.Models.Balance.Response.BalanceReport.Specific.TransactionCategories {
public record TransactionCategoriesSummaryBalances {
public required BalanceReportAmount Pending { get; init; }
public required BalanceReportAmount Available { get; init; }
public required BalanceReportAmount Pending { get; set; }
public required BalanceReportAmount Available { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace Mollie.Api.Models.Balance.Response.BalanceReport.Specific.TransactionCategories {
public record TransactionCategoriesTotal {
public required TransactionCategoriesSummaryBalances Open { get; init; }
public required TransactionCategoriesSummaryBalances Close { get; init; }
public required TransactionCategoriesTransaction Payments { get; init; }
public required TransactionCategoriesTransaction Refunds { get; init; }
public required TransactionCategoriesTransaction Chargebacks { get; init; }
public required TransactionCategoriesTransaction Capital { get; init; }
public required TransactionCategoriesTransaction Transfers { get; init; }
public required TransactionCategoriesSummaryBalances Open { get; set; }
public required TransactionCategoriesSummaryBalances Close { get; set; }
public required TransactionCategoriesTransaction Payments { get; set; }
public required TransactionCategoriesTransaction Refunds { get; set; }
public required TransactionCategoriesTransaction Chargebacks { get; set; }
public required TransactionCategoriesTransaction Capital { get; set; }
public required TransactionCategoriesTransaction Transfers { get; set; }
[JsonProperty("fee-prepayments")]
public required TransactionCategoriesTransaction FeePrepayments { get; init; }
public required TransactionCategoriesTransaction Corrections { get; init; }
public required TransactionCategoriesTransaction FeePrepayments { get; set; }
public required TransactionCategoriesTransaction Corrections { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Mollie.Api.Models.Balance.Response.BalanceReport.Specific.TransactionCategories {
public record TransactionCategoriesTransaction {
public required BalanceReportAmountWithSubtotals Pending { get; init; }
public required BalanceReportAmountWithSubtotals MovedToAvailable { get; init; }
public required BalanceReportAmountWithSubtotals ImmediatelyAvailable { get; init; }
public required BalanceReportAmountWithSubtotals Pending { get; set; }
public required BalanceReportAmountWithSubtotals MovedToAvailable { get; set; }
public required BalanceReportAmountWithSubtotals ImmediatelyAvailable { get; set; }
}
}
}
46 changes: 23 additions & 23 deletions src/Mollie.Api/Models/Balance/Response/BalanceResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,65 +7,65 @@ public class BalanceResponse {
/// <summary>
/// Indicates the response contains a balance object. Will always contain balance for this endpoint.
/// </summary>
public required string Resource { get; init; }
public required string Resource { get; set; }

/// <summary>
/// The identifier uniquely referring to this balance. Mollie assigns this identifier at balance creation time. For example bal_gVMhHKqSSRYJyPsuoPNFH.
/// </summary>
public required string Id { get; init; }
public required string Id { get; set; }

/// <summary>
/// The balance’s date and time of creation, in ISO 8601 format.
/// </summary>
public required DateTime CreatedAt { get; init; }
public required DateTime CreatedAt { get; set; }

/// <summary>
/// The balance’s ISO 4217 currency code.
/// The balance’s ISO 4217 currency code.
/// </summary>
public required string Currency { get; init; }
public required string Currency { get; set; }

/// <summary>
/// The status of the balance.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public required BalanceResponseStatus Status { get; init; }
public required BalanceResponseStatus Status { get; set; }

/// <summary>
/// The frequency at which the available amount on the balance will be settled to the configured transfer destination.
/// See transferDestination.
/// </summary>
public required string TransferFrequency { get; init; }
public required string TransferFrequency { get; set; }

/// <summary>
/// The minimum amount configured for scheduled automatic settlements. As soon as the amount on the balance exceeds this threshold,
/// the complete balance will be paid out to the transferDestination according to the configured transferFrequency.
/// </summary>
public required Amount TransferThreshold { get; init; }
public required Amount TransferThreshold { get; set; }

/// <summary>
/// The transfer reference set to be included in all the transfers for this balance. Either a string or null.
/// </summary>
public string? TransferReference { get; set; }

/// <summary>
/// The destination where the available amount will be automatically transferred to according to the configured transferFrequency.
/// </summary>
public required BalanceTransferDestination TransferDestination { get; init; }
public required BalanceTransferDestination TransferDestination { get; set; }

/// <summary>
/// The amount directly available on the balance, e.g. {"currency":"EUR", "value":"100.00"}.
/// </summary>
public required Amount AvailableAmount { get; init; }
public required Amount AvailableAmount { get; set; }

/// <summary>
/// The total amount that is queued to be transferred to your balance. For example, a credit card payment can take a few days to clear.
/// </summary>
public required Amount PendingAmount { get; init; }
public required Amount PendingAmount { get; set; }

/// <summary>
/// An object with several URL objects relevant to the balance. Every URL object will contain an href and a type field.
/// </summary>
[JsonProperty("_links")]
public required BalanceResponseLinks Links { get; init; }
public required BalanceResponseLinks Links { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ public class BalanceResponseLinks {
/// <summary>
/// The API resource URL of the balance itself.
/// </summary>
public required UrlObjectLink<BalanceResponse> Self { get; init; }
public required UrlObjectLink<BalanceResponse> Self { get; set; }

/// <summary>
/// The URL to the order retrieval endpoint documentation.
/// </summary>
public required UrlLink Documentation { get; init; }
public required UrlLink Documentation { get; set; }
}
}
}
Loading

0 comments on commit d7800b6

Please sign in to comment.