Skip to content

Commit

Permalink
Add more XML comments and fix all editorconfig warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Viincenttt committed May 14, 2024
1 parent ec2e6f9 commit 691623f
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 12 deletions.
81 changes: 81 additions & 0 deletions src/Mollie.Api/Client/Abstract/IBalanceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,95 @@

namespace Mollie.Api.Client.Abstract {
public interface IBalanceClient : IBaseMollieClient {
/// <summary>
/// Retrieve a single balance object by its balance identifier.
/// </summary>
/// <param name="balanceId">The balance identifier to retrieve</param>
/// <returns></returns>
Task<BalanceResponse> GetBalanceAsync(string balanceId);

/// <summary>
/// Retrieve a single balance object using an URL
/// </summary>
/// <param name="url">The URL of the balance object</param>
/// <returns></returns>
Task<BalanceResponse> GetBalanceAsync(UrlObjectLink<BalanceResponse> url);

/// <summary>
/// Retrieve the primary balance. This is the balance of your account’s primary currency, where all payments are
/// settled to by default.
/// </summary>
/// <returns></returns>
Task<BalanceResponse> GetPrimaryBalanceAsync();

/// <summary>
/// Retrieve all the organization’s balances, including the primary balance, ordered from newest to oldest.
/// </summary>
/// <param name="from">Offset the result set to the balance with this ID. The balance with this ID is included
/// in the result set as well.</param>
/// <param name="limit">The number of balances to return (with a maximum of 250).</param>
/// <param name="currency">Currency filter that will make it so only balances in given currency are returned.
/// For example EUR.</param>
/// <returns></returns>
Task<ListResponse<BalanceResponse>> ListBalancesAsync(string? from = null, int? limit = null, string? currency = null);

/// <summary>
/// Retrieve all the organization’s balances by URL
/// </summary>
/// <param name="url">The URL of the balance objects</param>
/// <returns></returns>
Task<ListResponse<BalanceResponse>> ListBalancesAsync(UrlObjectLink<ListResponse<BalanceResponse>> url);

/// <summary>
/// With the Get balance report endpoint you can retrieve a summarized report for all movements on a given
/// balance within a given timeframe.
/// </summary>
/// <param name="balanceId">The balance id for which to retrieve a report</param>
/// <param name="from">he 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.</param>
/// <param name="until">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.</param>
/// <param name="grouping">You can retrieve reports in two different formats: status-balances and
/// transaction-categories</param>
/// <returns></returns>
Task<BalanceReportResponse> GetBalanceReportAsync(string balanceId, DateTime from, DateTime until, string? grouping = null);

/// <summary>
/// With the Get primary balance report endpoint you can retrieve a summarized report for all movements on your
/// primary balance within a given timeframe.
/// </summary>
/// <param name="from">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.</param>
/// <param name="until">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.</param>
/// <param name="grouping">You can retrieve reports in two different formats: status-balances and
/// transaction-categories</param>
/// <returns></returns>
Task<BalanceReportResponse> GetPrimaryBalanceReportAsync(DateTime from, DateTime until, string? grouping = null);

/// <summary>
/// With the List balance transactions endpoint you can retrieve a list of all the movements on your balance.
/// This includes payments, refunds, chargebacks, and settlements.
/// </summary>
/// <param name="balanceId">The balance id for which to retrieve a report</param>
/// <param name="from">Offset the result set to the balance transactions with this ID. The balance transaction
/// with this ID is included in the result set as well.</param>
/// <param name="limit">The number of balance transactions to return (with a maximum of 250).</param>
/// <returns></returns>
Task<BalanceTransactionResponse> ListBalanceTransactionsAsync(string balanceId, string? from = null, int? limit = null);

/// <summary>
/// With the List primary balance transactions endpoint you can retrieve a list of all the movements on your
/// primary balance. This includes payments, refunds, chargebacks, and settlements.
/// </summary>
/// <param name="from">Offset the result set to the balance transactions with this ID. The balance transaction
/// with this ID is included in the result set as well.</param>
/// <param name="limit">The number of balance transactions to return (with a maximum of 250).</param>
/// <returns></returns>
Task<BalanceTransactionResponse> ListPrimaryBalanceTransactionsAsync(string? from = null, int? limit = null);
}
}
47 changes: 41 additions & 6 deletions src/Mollie.Api/Client/Abstract/IPaymentClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ public interface IPaymentClient : IBaseMollieClient {
Task<PaymentResponse> CreatePaymentAsync(PaymentRequest paymentRequest, bool includeQrCode = false);

/// <summary>
/// Retrieve a single payment object by its payment identifier.
/// Retrieve a single payment object by its payment identifier.
/// </summary>
/// <param name="paymentId">The payment's ID, for example tr_7UhSN1zuXS.</param>
/// <param name="testmode">Oauth - Optional – Set this to true to get a payment made in test mode. If you omit this parameter, you can only retrieve live mode payments.</param>
/// <param name="testmode">Oauth - Optional – Set this to true to get a payment made in test mode. If you omit
/// this parameter, you can only retrieve live mode payments.</param>
/// <param name="includeQrCode">Include a QR code object. Only available for iDEAL, Bancontact and bank transfer
/// payments.</param>
/// <param name="includeRemainderDetails">Include the Payment method-specific response parameters of the
/// ‘remainder payment’ as well. This applies to gift card and voucher payments where only part of the payment
/// was completed with gift cards or vouchers, and the remainder was completed with a regular payment method.
/// </param>
/// <param name="embedRefunds">Include all refunds created for the payment.</param>
/// <param name="embedChargebacks"> Include all chargebacks issued for the payment.</param>
/// <returns></returns>
Task<PaymentResponse> GetPaymentAsync(
string paymentId,
Expand All @@ -27,16 +36,26 @@ Task<PaymentResponse> GetPaymentAsync(
/// Some payment methods are cancellable for an amount of time, usually until the next day. Or as long as the payment status is open. Payments may be cancelled manually from the Dashboard, or automatically by using this endpoint.
/// </summary>
/// <param name="paymentId"></param>
/// <param name="testmode">Oauth - Optional – Set this to true to cancel a test mode payment.</param>
/// <returns></returns>
Task DeletePaymentAsync(string paymentId, bool testmode = false);

/// <summary>
/// Retrieve all payments created with the current payment profile, ordered from newest to oldest.
/// </summary>
/// <param name="from"></param>
/// <param name="limit"></param>
/// <param name="profileId"></param>
/// <param name="testmode"></param>
/// <param name="from">Used for pagination. Offset the result set to the payment with this ID. The payment with
/// this ID is included in the result set as well.</param>
/// <param name="limit">The number of payments to return (with a maximum of 250).</param>
/// <param name="profileId">The website profile’s unique identifier, for example pfl_3RkSN1zuPE. Omit this
/// parameter to retrieve all payments across all profiles.</param>
/// <param name="testmode">Set this to true to only retrieve payments made in test mode. By default, only live
/// payments are returned.</param>
/// <param name="includeQrCode">Include a QR code object for each payment that supports it. Only available for
/// iDEAL, Bancontact and bank transfer payments.</param>
/// <param name="embedRefunds">Include any refunds created for the payments.</param>
/// <param name="embedChargebacks">Include any chargebacks issued for the payments.</param>
/// <param name="sort">Used for setting the direction of the results based on the from parameter. Can be set
/// to desc or asc. Default is desc.</param>
/// <returns></returns>
Task<ListResponse<PaymentResponse>> GetPaymentListAsync(
string? from = null,
Expand All @@ -48,10 +67,26 @@ Task<ListResponse<PaymentResponse>> GetPaymentListAsync(
bool embedChargebacks = false,
SortDirection? sort = null);

/// <summary>
/// Retrieve a list of payments by URL
/// </summary>
/// <param name="url">The URL from which to retrieve the payments</param>
/// <returns></returns>
Task<ListResponse<PaymentResponse>> GetPaymentListAsync(UrlObjectLink<ListResponse<PaymentResponse>> url);

/// <summary>
/// Retrieve a single payment by URL
/// </summary>
/// <param name="url">The URL from which to retrieve the payment</param>
/// <returns></returns>
Task<PaymentResponse> GetPaymentAsync(UrlObjectLink<PaymentResponse> url);

/// <summary>
/// This endpoint can be used to update some details of a created payment.
/// </summary>
/// <param name="paymentId">The payment id to update</param>
/// <param name="paymentUpdateRequest">The payment parameters to update</param>
/// <returns></returns>
Task<PaymentResponse> UpdatePaymentAsync(string paymentId, PaymentUpdateRequest paymentUpdateRequest);
}
}
32 changes: 29 additions & 3 deletions src/Mollie.Api/Client/Abstract/IPaymentLinkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,47 @@

namespace Mollie.Api.Client.Abstract {
public interface IPaymentLinkClient : IBaseMollieClient {
/// <summary>
/// Create a new payment link
/// </summary>
/// <param name="paymentLinkRequest">The payment link request</param>
/// <returns></returns>
Task<PaymentLinkResponse> CreatePaymentLinkAsync(PaymentLinkRequest paymentLinkRequest);

/// <summary>
/// Retrieve a single payment link object by its token.
/// </summary>
/// <param name="paymentLinkId">The payment link to retrieve</param>
/// <param name="testmode">Oauth - Optional – Set this to true to get a payment links made in test mode. If you omit
/// this parameter, you can only retrieve live mode payments.</param>
Task<PaymentLinkResponse> GetPaymentLinkAsync(string paymentLinkId, bool testmode = false);

/// <summary>
/// Retrieve all payment links created with the current payment link profile, ordered from newest to oldest.
/// </summary>
/// <param name="from"></param>
/// <param name="limit"></param>
/// <param name="from">Used for pagination. Offset the result set to the payment link with this ID. The payment
/// link with this ID is included in the result set as well.</param>
/// <param name="limit">The number of payment links to return (with a maximum of 250).</param>
/// <param name="profileId">The website profile’s unique identifier, for example pfl_3RkSN1zuPE. Omit this
/// parameter to retrieve the payment links of all profiles of the current organization.</param>
/// <param name="testmode">Set this to true to only retrieve payment links made in test mode. By default, only
/// live payment links are returned.</param>
/// <returns></returns>
Task<ListResponse<PaymentLinkResponse>> GetPaymentLinkListAsync(
string? from = null, int? limit = null, string? profileId = null, bool testmode = false);

/// <summary>
/// Retrieve a list of payment links by URL
/// </summary>
/// <param name="url">The URL from which to retrieve the payment links</param>
/// <returns></returns>
Task<ListResponse<PaymentLinkResponse>> GetPaymentLinkListAsync(string? from = null, int? limit = null, string? profileId = null, bool testmode = false);
Task<ListResponse<PaymentLinkResponse>> GetPaymentLinkListAsync(UrlObjectLink<ListResponse<PaymentLinkResponse>> url);

/// <summary>
/// Retrieve a single payment link by URL
/// </summary>
/// <param name="url">The URL from which to retrieve the payment link</param>
/// <returns></returns>
Task<PaymentLinkResponse> GetPaymentLinkAsync(UrlObjectLink<PaymentLinkResponse> url);
}
}
6 changes: 3 additions & 3 deletions tests/Mollie.Tests.Integration/Api/OrderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public async Task ManageOrderLinesAsync_AddOperation_OrderLineIsAdded() {
addedOrderLineRequest.TotalAmount.Should().Be(newOrderLineRequest.TotalAmount);
addedOrderLineRequest.VatRate.Should().Be(newOrderLineRequest.VatRate);
addedOrderLineRequest.VatAmount.Should().Be(newOrderLineRequest.VatAmount);
var newMetaData = addedOrderLineRequest.Metadata
var newMetaData = addedOrderLineRequest.Metadata!
.Replace(Environment.NewLine, "")
.Replace(" ", "");
newMetaData.Should().Be(newOrderLineRequest.Metadata);
Expand Down Expand Up @@ -342,12 +342,12 @@ public async Task ManageOrderLinesAsync_UpdateOperation_OrderLineIsUpdated() {
updatedOrder.Lines.Should().HaveCount(1);
var addedOrderLineRequest = updatedOrder.Lines.SingleOrDefault(line => line.Name == orderLineUpdateRequest.Name);
addedOrderLineRequest.Should().NotBeNull();
addedOrderLineRequest.Quantity.Should().Be(orderLineUpdateRequest.Quantity);
addedOrderLineRequest!.Quantity.Should().Be(orderLineUpdateRequest.Quantity);
addedOrderLineRequest.UnitPrice.Should().Be(orderLineUpdateRequest.UnitPrice);
addedOrderLineRequest.TotalAmount.Should().Be(orderLineUpdateRequest.TotalAmount);
addedOrderLineRequest.VatRate.Should().Be(orderLineUpdateRequest.VatRate);
addedOrderLineRequest.VatAmount.Should().Be(orderLineUpdateRequest.VatAmount);
addedOrderLineRequest.Metadata
addedOrderLineRequest.Metadata!
.Replace(Environment.NewLine, "")
.Replace(" ", "")
.Should().Be(orderLineUpdateRequest.Metadata);
Expand Down

0 comments on commit 691623f

Please sign in to comment.