diff --git a/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponse.cs b/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponse.cs index 3722eb90..212d7ad4 100644 --- a/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponse.cs +++ b/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponse.cs @@ -40,12 +40,12 @@ public class PaymentLinkResponse : IResponseObject /// /// The URL your customer will be redirected to after completing the payment process. /// - public string RedirectUrl { get; set; } + public string? RedirectUrl { get; set; } /// /// The URL Mollie will call as soon an important status change takes place. /// - public string WebhookUrl { get; set; } + public string? WebhookUrl { get; set; } /// /// The payment link’s date and time of creation, in ISO 8601 format. @@ -62,7 +62,6 @@ public class PaymentLinkResponse : IResponseObject /// public DateTime? UpdatedAt { get; set; } - /// /// The expiry date and time of the payment link, in ISO 8601 format. /// diff --git a/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponseLinks.cs b/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponseLinks.cs index e37fe3df..a67c08a1 100644 --- a/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponseLinks.cs +++ b/src/Mollie.Api/Models/PaymentLink/Response/PaymentLinkResponseLinks.cs @@ -1,27 +1,20 @@ -using Mollie.Api.Models.Chargeback; -using Mollie.Api.Models.Customer; -using Mollie.Api.Models.List; -using Mollie.Api.Models.Mandate; -using Mollie.Api.Models.Settlement; -using Mollie.Api.Models.Subscription; -using Mollie.Api.Models.Url; +using Mollie.Api.Models.Url; namespace Mollie.Api.Models.PaymentLink.Response { public class PaymentLinkResponseLinks { /// /// The API resource URL of the payment link itself. /// - public UrlObjectLink Self { get; set; } + public required UrlObjectLink Self { get; init; } /// /// Direct link to the payment link. /// - public UrlLink PaymentLink { get; set; } + public required UrlLink PaymentLink { get; init; } /// ///The URL to the payment link retrieval endpoint documentation. /// - public UrlLink Documentation { get; set; } - + public required UrlLink Documentation { get; init; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponse.cs b/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponse.cs index f718546b..829518e9 100644 --- a/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponse.cs +++ b/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponse.cs @@ -18,41 +18,41 @@ public class PaymentMethodResponse : IResponseObject { /// /// The full name of the payment method. /// - public string Description { get; set; } + public required string Description { get; init; } /// /// Minimum payment amount required to use this payment method. /// - public Amount MinimumAmount { get; set; } + public required Amount MinimumAmount { get; init; } /// /// Maximum payment amount allowed when using this payment method. (Could be null) /// - public Amount MaximumAmount { get; set; } + public required Amount MaximumAmount { get; init; } /// /// URLs of images representing the payment method. /// - public PaymentMethodResponseImage Image { get; set; } + public required PaymentMethodResponseImage Image { get; init; } /// /// List of Issuers /// - public List Issuers { get; set; } + public List? Issuers { get; set; } /// /// Pricing set of the payment method what will be include if you add the parameter. /// - public List Pricing { get; set; } + public List? Pricing { get; set; } /// /// An object with several URL objects relevant to the payment method. Every URL object will contain an href and a type field. /// [JsonProperty("_links")] - public PaymentMethodResponseLinks Links { get; set; } + public required PaymentMethodResponseLinks Links { get; init; } public override string ToString() { - return this.Description; + return Description; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponseImage.cs b/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponseImage.cs index ba135cf5..06b76c86 100644 --- a/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponseImage.cs +++ b/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponseImage.cs @@ -6,20 +6,20 @@ public class PaymentMethodResponseImage { /// /// The URL for a payment method icon of 55x37 pixels. /// - public string Size1x { get; set; } + public required string Size1x { get; init; } /// /// The URL for a payment method icon of 110x74 pixels. Use this for high resolution screens. /// - public string Size2x { get; set; } + public required string Size2x { get; init; } /// /// The URL for a payment method icon in vector format. Usage of this format is preferred since it can scale to any desired size. /// - public string Svg { get; set; } + public required string Svg { get; init; } public override string ToString() { - return this.Size1x; + return Size1x; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponseLinks.cs b/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponseLinks.cs index 3f265e81..1e929cd4 100644 --- a/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponseLinks.cs +++ b/src/Mollie.Api/Models/PaymentMethod/PaymentMethodResponseLinks.cs @@ -5,11 +5,11 @@ public class PaymentMethodResponseLinks { /// /// The API resource URL of the payment method itself. /// - public UrlObjectLink Self { get; set; } + public required UrlObjectLink Self { get; init; } /// /// The URL to the payment method retrieval endpoint documentation. /// - public UrlLink Documentation { get; set; } + public required UrlLink Documentation { get; init; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/PaymentMethod/Pricing/FixedPricingResponse.cs b/src/Mollie.Api/Models/PaymentMethod/Pricing/FixedPricingResponse.cs index ea466f04..aef1802a 100644 --- a/src/Mollie.Api/Models/PaymentMethod/Pricing/FixedPricingResponse.cs +++ b/src/Mollie.Api/Models/PaymentMethod/Pricing/FixedPricingResponse.cs @@ -4,11 +4,11 @@ public class FixedPricingResponse : IResponseObject { /// /// The ISO 4217 currency code. /// - public string Currency { get; set; } + public required string Currency { get; init; } /// /// A string containing the exact amount in the given currency. /// - public decimal Value { get; set; } + public required decimal Value { get; init; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/PaymentMethod/Pricing/PricingResponse.cs b/src/Mollie.Api/Models/PaymentMethod/Pricing/PricingResponse.cs index e3f005ba..fdd6d142 100644 --- a/src/Mollie.Api/Models/PaymentMethod/Pricing/PricingResponse.cs +++ b/src/Mollie.Api/Models/PaymentMethod/Pricing/PricingResponse.cs @@ -4,23 +4,23 @@ public class PricingResponse : IResponseObject { /// /// The area or product-type where the pricing is applied for, translated in the optional locale passed. /// - public string Description { get; set; } + public required string Description { get; init; } /// /// The fixed price per transaction /// - public FixedPricingResponse Fixed { get; set; } + public required FixedPricingResponse Fixed { get; init; } /// /// A string containing the percentage what will be charged over the payment amount besides the fixed price. /// - public decimal Variable { get; set; } + public required decimal Variable { get; init; } /// /// This value is only available for credit card rates. It will correspond with the regions as documented in /// the Payments API. See the Mollie.Api.Models.Payment.Response.CreditCardFeeRegion class for a full list of /// known values. /// - public string FeeRegion { get; set; } + public required string? FeeRegion { get; set; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/Permission/PermissionResponse.cs b/src/Mollie.Api/Models/Permission/PermissionResponse.cs index f90d3b07..f1a96658 100644 --- a/src/Mollie.Api/Models/Permission/PermissionResponse.cs +++ b/src/Mollie.Api/Models/Permission/PermissionResponse.cs @@ -16,7 +16,7 @@ public class PermissionResponse : IResponseObject { /// /// A short description of what the permission allows. /// - public string Description { get; set; } + public required string Description { get; init; } /// /// Whether this permission is granted to the app by the organization or not. @@ -27,6 +27,6 @@ public class PermissionResponse : IResponseObject { /// An object with several URL objects relevant to the permission. Every URL object will contain an href and a type field. /// [JsonProperty("_links")] - public PermissionResponseLinks Links { get; set; } + public required PermissionResponseLinks Links { get; init; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/Permission/PermissionResponseLInks.cs b/src/Mollie.Api/Models/Permission/PermissionResponseLInks.cs index 5854982c..0305c7b9 100644 --- a/src/Mollie.Api/Models/Permission/PermissionResponseLInks.cs +++ b/src/Mollie.Api/Models/Permission/PermissionResponseLInks.cs @@ -5,11 +5,11 @@ public class PermissionResponseLinks { /// /// The API resource URL of the permission itself. /// - public UrlObjectLink Self { get; set; } + public required UrlObjectLink Self { get; init; } /// /// The URL to the permission retrieval endpoint documentation. /// - public UrlLink Documentation { get; set; } + public required UrlLink Documentation { get; init; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/Profile/Request/ProfileRequest.cs b/src/Mollie.Api/Models/Profile/Request/ProfileRequest.cs index 0f19d04d..8125ebdb 100644 --- a/src/Mollie.Api/Models/Profile/Request/ProfileRequest.cs +++ b/src/Mollie.Api/Models/Profile/Request/ProfileRequest.cs @@ -1,43 +1,42 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace Mollie.Api.Models.Profile.Request { public class ProfileRequest { /// /// The profile's name should reflect the tradename or brand name of the profile's website or application. /// - public string Name { get; set; } + public required string Name { get; init; } /// /// The URL to the profile's website or application. The URL should start with http:// or https://. /// - public string Website { get; set; } + public required string Website { get; init; } /// /// The email address associated with the profile's tradename or brand. /// - public string Email { get; set; } + public required string Email { get; init; } /// /// The phone number associated with the profile's tradename or brand. /// - public string Phone { get; set; } + public required string Phone { get; init; } /// /// The products or services that the profile’s website offers. /// - public string Description { get; set; } + public string? Description { get; set; } /// /// The list of countries where you expect that the majority of the profile’s customers will live, in ISO 3166-1 alpha-2 format. /// - public IEnumerable CountriesOfActivity { get; set; } + public IEnumerable? CountriesOfActivity { get; set; } /// /// The industry associated with the profile’s trade name or brand. Please refer to the documentation of the business category /// for more information on which values are accepted. /// - public string BusinessCategory { get; set; } + public string? BusinessCategory { get; set; } /// /// Optional – Creating a test profile by setting this parameter to test, enables you to start using the API without diff --git a/src/Mollie.Api/Models/Profile/Response/ApiKey.cs b/src/Mollie.Api/Models/Profile/Response/ApiKey.cs index 665b08e8..890ee934 100644 --- a/src/Mollie.Api/Models/Profile/Response/ApiKey.cs +++ b/src/Mollie.Api/Models/Profile/Response/ApiKey.cs @@ -16,7 +16,7 @@ public class ApiKey { /// The actual API key, which you'll use when creating payments or when otherwise communicating with the API. Never /// share the API key with anyone. /// - public string Key { get; set; } + public required string Key { get; init; } /// /// The API key's date and time of creation. diff --git a/src/Mollie.Api/Models/Profile/Response/EnableGiftCardIssuerResponse.cs b/src/Mollie.Api/Models/Profile/Response/EnableGiftCardIssuerResponse.cs index f7817cdb..3a12f309 100644 --- a/src/Mollie.Api/Models/Profile/Response/EnableGiftCardIssuerResponse.cs +++ b/src/Mollie.Api/Models/Profile/Response/EnableGiftCardIssuerResponse.cs @@ -15,17 +15,17 @@ public class EnableGiftCardIssuerResponse { /// /// The full name of the gift card issuer. /// - public string Description { get; set; } + public required string Description { get; init; } /// /// The status that the issuer is in. Possible values: pending-issuer or activated. /// - public string Status { get; set; } + public required string Status { get; init; } /// /// An object with several URL objects relevant to the order. Every URL object will contain an href and a type field. /// [JsonProperty("_links")] - public EnableGiftCardIssuerResponseLinks Links { get; set; } + public required EnableGiftCardIssuerResponseLinks Links { get; init; } } } diff --git a/src/Mollie.Api/Models/Profile/Response/EnableGiftCardIssuerResponseLinks.cs b/src/Mollie.Api/Models/Profile/Response/EnableGiftCardIssuerResponseLinks.cs index c8f5b572..aa23b7f0 100644 --- a/src/Mollie.Api/Models/Profile/Response/EnableGiftCardIssuerResponseLinks.cs +++ b/src/Mollie.Api/Models/Profile/Response/EnableGiftCardIssuerResponseLinks.cs @@ -5,11 +5,11 @@ public class EnableGiftCardIssuerResponseLinks { /// /// The API resource URL of the gift card issuer itself. /// - public UrlLink Self { get; set; } + public required UrlLink Self { get; init; } /// /// The URL to the gift card issuer retrieval endpoint documentation. /// - public UrlLink Documentation { get; set; } + public required UrlLink Documentation { get; init; } } } diff --git a/src/Mollie.Api/Models/Profile/Response/ProfileResponse.cs b/src/Mollie.Api/Models/Profile/Response/ProfileResponse.cs index da256225..93c1ab6a 100644 --- a/src/Mollie.Api/Models/Profile/Response/ProfileResponse.cs +++ b/src/Mollie.Api/Models/Profile/Response/ProfileResponse.cs @@ -24,38 +24,38 @@ public class ProfileResponse : IResponseObject { /// The payment profile's name, this will usually reflect the tradename or brand name of the profile's website or /// application. /// - public string Name { get; set; } + public required string Name { get; init; } /// /// The URL to the profile's website or application. /// - public string Website { get; set; } + public required string Website { get; init; } /// /// The products or services that the profile’s website offers. /// - public string Description { get; set; } + public string? Description { get; set; } /// /// The list of countries where you expect that the majority of the profile’s customers will live, in ISO 3166-1 alpha-2 format. /// - public IEnumerable CountriesOfActivity { get; set; } + public IEnumerable? CountriesOfActivity { get; set; } /// /// The email address associated with the profile's tradename or brand. /// - public string Email { get; set; } + public required string Email { get; init; } /// /// The phone number associated with the profile's tradename or brand. /// - public string Phone { get; set; } + public required string Phone { get; init; } /// /// The industry associated with the profile’s trade name or brand. Please refer to the documentation of the business category /// for more information on which values are accepted. /// - public string BusinessCategory { get; set; } + public string? BusinessCategory { get; set; } /// /// The industry associated with the profile's tradename or brand. @@ -67,25 +67,25 @@ public class ProfileResponse : IResponseObject { /// The profile status determines whether the payment profile is able to receive live payments. See the /// Mollie.Api.Models.Profile.ProfileStatus class for a full list of known values. /// - public string Status { get; set; } + public required string Status { get; init; } /// /// The presence of a review object indicates changes have been made that have not yet been approved by Mollie. /// Changes to test profiles are approved automatically, unless a switch to a live profile has been requested. /// The review object will therefore usually be null in test mode. /// - public Review Review { get; set; } + public Review? Review { get; set; } /// /// The payment profile's date and time of creation. /// - public DateTime CreatedAt { get; set; } + public required DateTime CreatedAt { get; init; } /// /// Useful URLs to related resources. /// [JsonProperty("_links")] - public ProfileResponseLinks Links { get; set; } + public required ProfileResponseLinks Links { get; init; } } public class Review { @@ -93,6 +93,6 @@ public class Review { /// The status of the requested profile changes. See the Mollie.Api.Models.Profile.ReviewStatus /// class for a full list of known values. /// - public string Status { get; set; } + public required string Status { get; init; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/Profile/Response/ProfileResponseLinks.cs b/src/Mollie.Api/Models/Profile/Response/ProfileResponseLinks.cs index b2b1eedc..65f6e66d 100644 --- a/src/Mollie.Api/Models/Profile/Response/ProfileResponseLinks.cs +++ b/src/Mollie.Api/Models/Profile/Response/ProfileResponseLinks.cs @@ -7,13 +7,13 @@ namespace Mollie.Api.Models.Profile.Response { public class ProfileResponseLinks { - public UrlObjectLink Self { get; set; } - public UrlLink Dashboard { get; set; } - public UrlObjectLink> Chargebacks { get; set; } - public UrlObjectLink> Methods { get; set; } - public UrlObjectLink> Payments { get; set; } - public UrlObjectLink> Refunds { get; set; } - public UrlLink CheckoutPreviewUrl { get; set; } - public UrlLink Documentation { get; set; } + public required UrlObjectLink Self { get; init; } + public required UrlLink Dashboard { get; init; } + public UrlObjectLink>? Chargebacks { get; set; } + public UrlObjectLink>? Methods { get; set; } + public UrlObjectLink>? Payments { get; set; } + public UrlObjectLink>? Refunds { get; set; } + public UrlLink? CheckoutPreviewUrl { get; set; } + public required UrlLink Documentation { get; init; } } } \ No newline at end of file diff --git a/tests/Mollie.Tests.Integration/Api/PaymentLinkTests.cs b/tests/Mollie.Tests.Integration/Api/PaymentLinkTests.cs index 506de7c7..340b5263 100644 --- a/tests/Mollie.Tests.Integration/Api/PaymentLinkTests.cs +++ b/tests/Mollie.Tests.Integration/Api/PaymentLinkTests.cs @@ -34,10 +34,7 @@ public async Task CanCreatePaymentLinkAndRetrieveIt() { // Given: We create a new payment PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest() { Description = "Test", - Amount = new Amount(Currency.EUR, 50), - WebhookUrl = this.DefaultWebhookUrl, - RedirectUrl = this.DefaultRedirectUrl, - ExpiresAt = DateTime.Now.AddDays(1) + Amount = new Amount(Currency.EUR, 50) }; var createdPaymentLinkResponse = await this._paymentLinkClient.CreatePaymentLinkAsync(paymentLinkRequest); diff --git a/tests/Mollie.Tests.Integration/Api/PaymentMethodTests.cs b/tests/Mollie.Tests.Integration/Api/PaymentMethodTests.cs index ac5c721a..96079277 100644 --- a/tests/Mollie.Tests.Integration/Api/PaymentMethodTests.cs +++ b/tests/Mollie.Tests.Integration/Api/PaymentMethodTests.cs @@ -23,7 +23,7 @@ public PaymentMethodTests() { [DefaultRetryFact] public async Task CanRetrievePaymentMethodList() { // When: Retrieve payment list with default settings - ListResponse response = await this._paymentMethodClient.GetPaymentMethodListAsync(); + ListResponse response = await this._paymentMethodClient.GetPaymentMethodListAsync(includePricing: true); // Then: Make sure it can be retrieved response.Should().NotBeNull(); diff --git a/tests/Mollie.Tests.Unit/Client/ProfileClientTests.cs b/tests/Mollie.Tests.Unit/Client/ProfileClientTests.cs index b9fca40d..0f203427 100644 --- a/tests/Mollie.Tests.Unit/Client/ProfileClientTests.cs +++ b/tests/Mollie.Tests.Unit/Client/ProfileClientTests.cs @@ -171,9 +171,17 @@ public async Task UpdateProfileAsync_WithMissingProfileIdParameter_ThrowsArgumen var mockHttp = new MockHttpMessageHandler(); HttpClient httpClient = mockHttp.ToHttpClient(); using var profileClient = new ProfileClient("abcde", httpClient); + ProfileRequest profileRequest = new ProfileRequest() { + Name = "My website name", + Email = "info@mywebsite.com", + Mode = Mode.Test, + Phone = "+31208202070", + Website = "https://www.mywebsite.com", + BusinessCategory = "OTHER_MERCHANDISE" + }; // Act - var exception = await Assert.ThrowsAsync(() => profileClient.UpdateProfileAsync(profileId, new ProfileRequest())); + var exception = await Assert.ThrowsAsync(() => profileClient.UpdateProfileAsync(profileId, profileRequest)); // Assert exception.Message.Should().Be($"Required URL argument '{nameof(profileId)}' is null or empty");