From 8761c53b7ade3182569cf75797283960f6f25a59 Mon Sep 17 00:00:00 2001 From: Axel Granillo Date: Fri, 29 Nov 2024 15:01:12 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20MOOV-3952:=20Add=20PayoutDocuments?= =?UTF-8?q?=20collection=20props?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Enums/PayoutDocumentTypesEnum.cs | 37 ++++++++++++ .../Models/Payouts/Payout.cs | 6 ++ .../Models/Payouts/PayoutCreate.cs | 6 ++ .../Models/Payouts/PayoutDocument.cs | 34 +++++++++++ .../Models/Payouts/PayoutDocumentCreate.cs | 60 +++++++++++++++++++ 5 files changed, 143 insertions(+) create mode 100644 src/NoFrixion.MoneyMoov/Enums/PayoutDocumentTypesEnum.cs create mode 100644 src/NoFrixion.MoneyMoov/Models/Payouts/PayoutDocument.cs create mode 100644 src/NoFrixion.MoneyMoov/Models/Payouts/PayoutDocumentCreate.cs diff --git a/src/NoFrixion.MoneyMoov/Enums/PayoutDocumentTypesEnum.cs b/src/NoFrixion.MoneyMoov/Enums/PayoutDocumentTypesEnum.cs new file mode 100644 index 00000000..6593e207 --- /dev/null +++ b/src/NoFrixion.MoneyMoov/Enums/PayoutDocumentTypesEnum.cs @@ -0,0 +1,37 @@ +// ----------------------------------------------------------------------------- +// Filename: PayoutDocumentTypesEnum.cs +// +// Description: Enum for the different types of payout documents. +// +// Author(s): +// Axel Granillo (axel@nofrixion.com) +// +// History: +// 28 11 2024 Axel Granillo Created, Remote, Mexico City, Mexico. +// +// License: +// MIT. +// ----------------------------------------------------------------------------- + +namespace NoFrixion.MoneyMoov.Enums; + +/// +/// Enum for the different types of payout documents. +/// +public enum PayoutDocumentTypesEnum +{ + /// + /// Default general value. + /// + Other, + + /// + /// Invoice. + /// + Invoice, + + /// + /// Purchase order. + /// + PurchaseOrder, +} \ No newline at end of file diff --git a/src/NoFrixion.MoneyMoov/Models/Payouts/Payout.cs b/src/NoFrixion.MoneyMoov/Models/Payouts/Payout.cs index e7e064bd..13efee22 100755 --- a/src/NoFrixion.MoneyMoov/Models/Payouts/Payout.cs +++ b/src/NoFrixion.MoneyMoov/Models/Payouts/Payout.cs @@ -408,7 +408,13 @@ public Counterparty? DestinationAccount /// Collection of payrun invoices associated with the payout. /// Will be empty if the payout is not associated with a payrun. /// + [Obsolete("Please refer to the Documents collection.")] public List? PayrunInvoices { get; set; } + + /// + /// Documents associated with the payout. + /// + public List? Documents { get; set; } public NoFrixionProblem Validate() { diff --git a/src/NoFrixion.MoneyMoov/Models/Payouts/PayoutCreate.cs b/src/NoFrixion.MoneyMoov/Models/Payouts/PayoutCreate.cs index a15d21dd..03176833 100755 --- a/src/NoFrixion.MoneyMoov/Models/Payouts/PayoutCreate.cs +++ b/src/NoFrixion.MoneyMoov/Models/Payouts/PayoutCreate.cs @@ -195,6 +195,12 @@ public Guid? BeneficiaryID /// payment, the default behaviour is to attempt SEPA-INST and fallback to SEPA-CT if rejected. /// public PaymentRailEnum PaymentRail { get; set; } + + /// + /// List of documents to attach to the payout. Optional. + /// Used for identifying or associating documents with the payout. + /// + public List? Documents { get; set; } /// /// Places all the payout's properties into a dictionary. diff --git a/src/NoFrixion.MoneyMoov/Models/Payouts/PayoutDocument.cs b/src/NoFrixion.MoneyMoov/Models/Payouts/PayoutDocument.cs new file mode 100644 index 00000000..ee611490 --- /dev/null +++ b/src/NoFrixion.MoneyMoov/Models/Payouts/PayoutDocument.cs @@ -0,0 +1,34 @@ +// ----------------------------------------------------------------------------- +// Filename: PayoutDocument.cs +// +// Description: Contains details of a payout document. +// +// Author(s): +// Axel Granillo (axel@nofrixion.com) +// +// History: +// 28 11 2024 Axel Granillo Created, Remote, Mexico City, Mexico. +// +// License: +// MIT. +// ----------------------------------------------------------------------------- + +using NoFrixion.MoneyMoov.Enums; + +namespace NoFrixion.MoneyMoov.Models; + +/// +/// Used for returning a payout document. +/// +public class PayoutDocument : PayoutDocumentCreate +{ + /// + /// Internal ID of the document. + /// + public Guid ID { get; set; } + + /// + /// Date of insertion. + /// + public DateTimeOffset Inserted { get; set; } +} \ No newline at end of file diff --git a/src/NoFrixion.MoneyMoov/Models/Payouts/PayoutDocumentCreate.cs b/src/NoFrixion.MoneyMoov/Models/Payouts/PayoutDocumentCreate.cs new file mode 100644 index 00000000..42b64025 --- /dev/null +++ b/src/NoFrixion.MoneyMoov/Models/Payouts/PayoutDocumentCreate.cs @@ -0,0 +1,60 @@ +// ----------------------------------------------------------------------------- +// Filename: PayoutDocumentCreate.cs +// +// Description: Contains details of a payout document. +// +// Author(s): +// Axel Granillo (axel@nofrixion.com) +// +// History: +// 28 11 2024 Axel Granillo Created, Remote, Mexico City, Mexico. +// +// License: +// MIT. +// ----------------------------------------------------------------------------- + +using System.ComponentModel.DataAnnotations; +using NoFrixion.MoneyMoov.Enums; + +namespace NoFrixion.MoneyMoov.Models; + +/// +/// Document associated with a payout. +/// +public class PayoutDocumentCreate +{ + /// + /// Type of the document. + /// + [Required] + public PayoutDocumentTypesEnum DocumentType { get; set; } = PayoutDocumentTypesEnum.Other; + + /// + /// Used to identify the document. + /// + [Required] + [MaxLength(128)] + public string? Title { get; set; } + + /// + /// Additional information about the document. Optional. + /// + [MaxLength(256)] + public string? Description { get; set; } + + /// + /// Currency of the document, if applicable. Optional. + /// + public CurrencyTypeEnum? Currency { get; set; } + + /// + /// Amount of the document, if applicable. Optional. + /// + public decimal? Amount { get; set; } + + /// + /// Allows to associate an external ID to the document. Optional. + /// + [MaxLength(128)] + public string? ExternalID { get; set; } +} \ No newline at end of file