Skip to content

Commit

Permalink
#368 Add models for payment lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Viincenttt committed Jun 13, 2024
1 parent 2417d09 commit 5a699af
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/Mollie.Api/Models/Payment/PaymentLine.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
namespace Mollie.Api.Models.Payment;

public record PaymentLine {
/// <summary>
/// The type of product purchased. For example, a physical or a digital product.
/// </summary>
public required string Type { get; init; }

/// <summary>
/// A description of the line item. For example LEGO 4440 Forest Police Station.
/// </summary>
public required string Description { get; init; }

/// <summary>
/// The number of items.
/// </summary>
public required int Quantity { get; init; }

/// <summary>
/// The unit for the quantity. For example pcs, kg, or cm.
/// </summary>
public required string QuantityUnit { get; init; }

/// <summary>
/// The price of a single item including VAT. The unit price can be zero in case of free items.
/// </summary>
public required Amount UnitPrice { get; init; }

/// <summary>
/// The total amount of the line, including VAT and discounts.
/// </summary>
public required Amount TotalAmount { get; init; }

/// <summary>
/// Any line-specific discounts, as a positive amount. Not relevant if the line itself is already a discount type.
/// </summary>
public Amount? DiscountAmount { get; set; }

/// <summary>
/// The VAT rate applied to the line, for example 21.00 for 21%. The vatRate should be passed as a string and not
/// as a float, to ensure the correct number of decimals are passed.
/// </summary>
public string? VatRate { get; set; } // TODO: make it decimal?

/// <summary>
/// The amount of value-added tax on the line. The totalAmount field includes VAT, so the vatAmount can be
/// calculated with the formula totalAmount × (vatRate / (100 + vatRate)).
/// </summary>
public Amount? VatAmount { get; set; }

/// <summary>
/// The SKU, EAN, ISBN or UPC of the product sold.
/// </summary>
public string? Sku { get; set; }

/// <summary>
/// A link pointing to an image of the product sold.
/// </summary>
public string? ImageUrl { get; set; }

/// <summary>
/// A link pointing to the product page in your web shop of the product sold.
/// </summary>
public string? ProductUrl { get; set; }
}
6 changes: 6 additions & 0 deletions src/Mollie.Api/Models/Payment/Request/PaymentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public record PaymentRequest
/// </summary>
public string? WebhookUrl { get; set; }

/// <summary>
/// Optionally provide the order lines for the payment. Each line contains details such as a description of the item ordered and its price.
/// All lines must have the same currency as the payment.
/// </summary>
public List<PaymentLine>? Lines { get; set; }

/// <summary>
/// Allows you to preset the language to be used in the payment screens shown to the consumer. Setting a locale is highly
/// recommended and will greatly improve your conversion rate. When this parameter is omitted, the browser language will
Expand Down
6 changes: 6 additions & 0 deletions src/Mollie.Api/Models/Payment/Response/PaymentResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ public record PaymentResponse
/// </summary>
public required string WebhookUrl { get; set; }

/// <summary>
/// Optionally provide the order lines for the payment. Each line contains details such as a description of the item ordered and its price.
/// All lines must have the same currency as the payment.
/// </summary>
public List<PaymentLine>? Lines { get; set; }

/// <summary>
/// An optional routing configuration that you provided, which enables you to route a successful payment, or part of the payment, to one or more connected accounts.
/// Additionally, you can schedule (parts of) the payment to become available on the connected account on a future date.
Expand Down

0 comments on commit 5a699af

Please sign in to comment.