diff --git a/src/Mercoa.Client.sln b/src/Mercoa.Client.sln index 38edbb8..7c0d6fe 100644 --- a/src/Mercoa.Client.sln +++ b/src/Mercoa.Client.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercoa.Client", "Mercoa.Client\Mercoa.Client.csproj", "{67C0D593-904A-4386-B4BB-82E8CBCB10BC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercoa.Client", "Mercoa.Client\Mercoa.Client.csproj", "{BE8670D2-2CF2-4965-93ED-046949573437}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercoa.Client.Test", "Mercoa.Client.Test\Mercoa.Client.Test.csproj", "{206F048D-00B8-494A-8C03-8C6CD9482A28}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercoa.Client.Test", "Mercoa.Client.Test\Mercoa.Client.Test.csproj", "{32AB4319-46E4-472F-9F93-41785194F553}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -16,13 +16,13 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {67C0D593-904A-4386-B4BB-82E8CBCB10BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {67C0D593-904A-4386-B4BB-82E8CBCB10BC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {67C0D593-904A-4386-B4BB-82E8CBCB10BC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {67C0D593-904A-4386-B4BB-82E8CBCB10BC}.Release|Any CPU.Build.0 = Release|Any CPU - {206F048D-00B8-494A-8C03-8C6CD9482A28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {206F048D-00B8-494A-8C03-8C6CD9482A28}.Debug|Any CPU.Build.0 = Debug|Any CPU - {206F048D-00B8-494A-8C03-8C6CD9482A28}.Release|Any CPU.ActiveCfg = Release|Any CPU - {206F048D-00B8-494A-8C03-8C6CD9482A28}.Release|Any CPU.Build.0 = Release|Any CPU + {BE8670D2-2CF2-4965-93ED-046949573437}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BE8670D2-2CF2-4965-93ED-046949573437}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BE8670D2-2CF2-4965-93ED-046949573437}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BE8670D2-2CF2-4965-93ED-046949573437}.Release|Any CPU.Build.0 = Release|Any CPU + {32AB4319-46E4-472F-9F93-41785194F553}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {32AB4319-46E4-472F-9F93-41785194F553}.Debug|Any CPU.Build.0 = Debug|Any CPU + {32AB4319-46E4-472F-9F93-41785194F553}.Release|Any CPU.ActiveCfg = Release|Any CPU + {32AB4319-46E4-472F-9F93-41785194F553}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/Mercoa.Client/Entity/PaymentMethod/PaymentMethodClient.cs b/src/Mercoa.Client/Entity/PaymentMethod/PaymentMethodClient.cs index 05b2ec6..265481d 100644 --- a/src/Mercoa.Client/Entity/PaymentMethod/PaymentMethodClient.cs +++ b/src/Mercoa.Client/Entity/PaymentMethod/PaymentMethodClient.cs @@ -158,7 +158,7 @@ CompleteMicroDepositsRequest request } /// - /// Get the available balance of a payment method. Only bank accounts added with Plaid are supported. This endpoint will return a cached value and will refresh the balance when called. + /// Deprecated. Get the available balance of a payment method. Only bank accounts added with Plaid are supported. This endpoint will return a cached value and will refresh the balance when called. /// public async Task GetBalanceAsync(string paymentMethodId) { diff --git a/src/Mercoa.Client/InvoiceTypes/Types/InvoiceCreationRequest.cs b/src/Mercoa.Client/InvoiceTypes/Types/InvoiceCreationRequest.cs index 5351af0..d2b43b1 100644 --- a/src/Mercoa.Client/InvoiceTypes/Types/InvoiceCreationRequest.cs +++ b/src/Mercoa.Client/InvoiceTypes/Types/InvoiceCreationRequest.cs @@ -35,7 +35,7 @@ public class InvoiceCreationRequest public DateTime? InvoiceDate { get; init; } /// - /// Date when funds will be deducted from payer's account. + /// Date when funds are scheduled to be deducted from payer's account. /// [JsonPropertyName("deductionDate")] public DateTime? DeductionDate { get; init; } @@ -129,4 +129,10 @@ public class InvoiceCreationRequest /// [JsonPropertyName("creatorUserId")] public string? CreatorUserId { get; init; } + + /// + /// If the invoice failed to be paid, indicate the failure reason. Only applicable for invoices with custom payment methods. + /// + [JsonPropertyName("failureType")] + public InvoiceFailureType? FailureType { get; init; } } diff --git a/src/Mercoa.Client/InvoiceTypes/Types/InvoiceRequestBase.cs b/src/Mercoa.Client/InvoiceTypes/Types/InvoiceRequestBase.cs index 58d7946..62633dc 100644 --- a/src/Mercoa.Client/InvoiceTypes/Types/InvoiceRequestBase.cs +++ b/src/Mercoa.Client/InvoiceTypes/Types/InvoiceRequestBase.cs @@ -29,7 +29,7 @@ public class InvoiceRequestBase public DateTime? InvoiceDate { get; init; } /// - /// Date when funds will be deducted from payer's account. + /// Date when funds are scheduled to be deducted from payer's account. /// [JsonPropertyName("deductionDate")] public DateTime? DeductionDate { get; init; } @@ -123,4 +123,10 @@ public class InvoiceRequestBase /// [JsonPropertyName("creatorUserId")] public string? CreatorUserId { get; init; } + + /// + /// If the invoice failed to be paid, indicate the failure reason. Only applicable for invoices with custom payment methods. + /// + [JsonPropertyName("failureType")] + public InvoiceFailureType? FailureType { get; init; } } diff --git a/src/Mercoa.Client/InvoiceTypes/Types/InvoiceResponse.cs b/src/Mercoa.Client/InvoiceTypes/Types/InvoiceResponse.cs index 5bbfbf9..6e95fa0 100644 --- a/src/Mercoa.Client/InvoiceTypes/Types/InvoiceResponse.cs +++ b/src/Mercoa.Client/InvoiceTypes/Types/InvoiceResponse.cs @@ -32,11 +32,17 @@ public class InvoiceResponse public DateTime? InvoiceDate { get; init; } /// - /// Date when funds will be deducted from payer's account. + /// Date when funds are scheduled to be deducted from payer's account. The actual deduction date may differ from this date, and will be reflected in the processedAt field. /// [JsonPropertyName("deductionDate")] public DateTime? DeductionDate { get; init; } + /// + /// Date when the invoice payment was processed. + /// + [JsonPropertyName("processedAt")] + public DateTime? ProcessedAt { get; init; } + /// /// Date of funds settlement. /// @@ -142,9 +148,6 @@ public class InvoiceResponse [JsonPropertyName("failureType")] public InvoiceFailureType? FailureType { get; init; } - [JsonPropertyName("processedAt")] - public DateTime? ProcessedAt { get; init; } - [JsonPropertyName("createdAt")] public DateTime CreatedAt { get; init; } diff --git a/src/Mercoa.Client/InvoiceTypes/Types/InvoiceUpdateRequest.cs b/src/Mercoa.Client/InvoiceTypes/Types/InvoiceUpdateRequest.cs index abbf42a..e0dad85 100644 --- a/src/Mercoa.Client/InvoiceTypes/Types/InvoiceUpdateRequest.cs +++ b/src/Mercoa.Client/InvoiceTypes/Types/InvoiceUpdateRequest.cs @@ -35,7 +35,7 @@ public class InvoiceUpdateRequest public DateTime? InvoiceDate { get; init; } /// - /// Date when funds will be deducted from payer's account. + /// Date when funds are scheduled to be deducted from payer's account. /// [JsonPropertyName("deductionDate")] public DateTime? DeductionDate { get; init; } @@ -129,4 +129,10 @@ public class InvoiceUpdateRequest /// [JsonPropertyName("creatorUserId")] public string? CreatorUserId { get; init; } + + /// + /// If the invoice failed to be paid, indicate the failure reason. Only applicable for invoices with custom payment methods. + /// + [JsonPropertyName("failureType")] + public InvoiceFailureType? FailureType { get; init; } } diff --git a/src/Mercoa.Client/Mercoa.Client.csproj b/src/Mercoa.Client/Mercoa.Client.csproj index bdecdac..5c8c603 100644 --- a/src/Mercoa.Client/Mercoa.Client.csproj +++ b/src/Mercoa.Client/Mercoa.Client.csproj @@ -5,7 +5,7 @@ net8.0;net7.0;net6.0;net5.0;net4.0 enable false - 0.4.2 + 0.4.3 README.md https://github.com/mercoa-finance/csharp diff --git a/src/Mercoa.Client/Mercoa.cs b/src/Mercoa.Client/Mercoa.cs index 7dffe61..9ee791f 100644 --- a/src/Mercoa.Client/Mercoa.cs +++ b/src/Mercoa.Client/Mercoa.cs @@ -19,7 +19,7 @@ public Mercoa(string token = null, ClientOptions clientOptions = null) { "Authorization", $"Bearer {token}" }, { "X-Fern-Language", "C#" }, { "X-Fern-SDK-Name", "Mercoa.Client" }, - { "X-Fern-SDK-Version", "0.4.2" }, + { "X-Fern-SDK-Version", "0.4.3" }, }, clientOptions ?? new ClientOptions() ); diff --git a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodFeeType.cs b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodFeeType.cs new file mode 100644 index 0000000..3ef9b58 --- /dev/null +++ b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodFeeType.cs @@ -0,0 +1,21 @@ +using System.Runtime.Serialization; +using System.Text.Json.Serialization; +using Mercoa.Client; +using Mercoa.Client.Core; + +#nullable enable + +namespace Mercoa.Client; + +[JsonConverter(typeof(StringEnumSerializer))] +public enum CustomPaymentMethodFeeType +{ + [EnumMember(Value = "none")] + None, + + [EnumMember(Value = "flat")] + Flat, + + [EnumMember(Value = "percentage")] + Percentage +} diff --git a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodRequest.cs b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodRequest.cs index 5599c1c..c229993 100644 --- a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodRequest.cs +++ b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodRequest.cs @@ -18,6 +18,12 @@ public class CustomPaymentMethodRequest [JsonPropertyName("accountNumber")] public string? AccountNumber { get; init; } + /// + /// The available balance for this payment method. + /// + [JsonPropertyName("availableBalance")] + public double? AvailableBalance { get; init; } + /// /// Payment method schema used for this payment method. Defines the fields that this payment method contains. /// diff --git a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodResponse.cs b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodResponse.cs index 3104f7b..9b90894 100644 --- a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodResponse.cs +++ b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodResponse.cs @@ -19,6 +19,12 @@ public class CustomPaymentMethodResponse [JsonPropertyName("accountNumber")] public string? AccountNumber { get; init; } + /// + /// The available balance for this payment method. + /// + [JsonPropertyName("availableBalance")] + public double? AvailableBalance { get; init; } + /// /// Payment method schema used for this payment method. Defines the fields that this payment method contains. /// diff --git a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaFee.cs b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaFee.cs new file mode 100644 index 0000000..d476c49 --- /dev/null +++ b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaFee.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; +using Mercoa.Client; + +#nullable enable + +namespace Mercoa.Client; + +public class CustomPaymentMethodSchemaFee +{ + [JsonPropertyName("type")] + public CustomPaymentMethodFeeType Type { get; init; } + + /// + /// If type is 'flat', this is the flat amount that will be charged as a fee. For example, if the fee is $2.50, set this to 2.50. If type is 'percentage', this is the percentage of the payment amount that will be charged as a fee. For example, if the fee is 2.5%, set this to 2.5. + /// + [JsonPropertyName("amount")] + public double? Amount { get; init; } +} diff --git a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaFieldType.cs b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaFieldType.cs index 6ad7b79..301ffd1 100644 --- a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaFieldType.cs +++ b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaFieldType.cs @@ -32,5 +32,11 @@ public enum CustomPaymentMethodSchemaFieldType Url, [EnumMember(Value = "address")] - Address + Address, + + [EnumMember(Value = "usBankRoutingNumber")] + UsBankRoutingNumber, + + [EnumMember(Value = "usBankAccountNumber")] + UsBankAccountNumber } diff --git a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaRequest.cs b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaRequest.cs index 44c7e07..8a0979d 100644 --- a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaRequest.cs +++ b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaRequest.cs @@ -22,12 +22,6 @@ public class CustomPaymentMethodSchemaRequest [JsonPropertyName("isDestination")] public bool IsDestination { get; init; } - /// - /// Estimated time in days for this payment method to process a payments. Set as 0 for same-day payment methods, -1 for unknown processing time. - /// - [JsonPropertyName("estimatedProcessingTime")] - public int? EstimatedProcessingTime { get; init; } - /// /// List of currencies that this payment method supports. If not provided, the payment method will support only USD. /// @@ -36,4 +30,13 @@ public class CustomPaymentMethodSchemaRequest [JsonPropertyName("fields")] public IEnumerable Fields { get; init; } + + /// + /// Estimated time in days for this payment method to process a payments. Set as 0 for same-day payment methods, -1 for unknown processing time. + /// + [JsonPropertyName("estimatedProcessingTime")] + public int? EstimatedProcessingTime { get; init; } + + [JsonPropertyName("fees")] + public CustomPaymentMethodSchemaFee? Fees { get; init; } } diff --git a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaResponse.cs b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaResponse.cs index 256022d..5a51d08 100644 --- a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaResponse.cs +++ b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodSchemaResponse.cs @@ -40,6 +40,9 @@ public class CustomPaymentMethodSchemaResponse [JsonPropertyName("estimatedProcessingTime")] public int EstimatedProcessingTime { get; init; } + [JsonPropertyName("fees")] + public CustomPaymentMethodSchemaFee? Fees { get; init; } + [JsonPropertyName("createdAt")] public DateTime CreatedAt { get; init; } diff --git a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodUpdateRequest.cs b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodUpdateRequest.cs index 9a0d369..90dbcdc 100644 --- a/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodUpdateRequest.cs +++ b/src/Mercoa.Client/PaymentMethodTypes/Types/CustomPaymentMethodUpdateRequest.cs @@ -18,6 +18,12 @@ public class CustomPaymentMethodUpdateRequest [JsonPropertyName("accountNumber")] public string? AccountNumber { get; init; } + /// + /// The available balance for this payment method. + /// + [JsonPropertyName("availableBalance")] + public double? AvailableBalance { get; init; } + /// /// Payment method schema used for this payment method. Defines the fields that this payment method contains. /// diff --git a/src/Mercoa.Client/Webhooks/Types/PaymentMethodWebhook.cs b/src/Mercoa.Client/Webhooks/Types/PaymentMethodWebhook.cs index 36db6af..497df9e 100644 --- a/src/Mercoa.Client/Webhooks/Types/PaymentMethodWebhook.cs +++ b/src/Mercoa.Client/Webhooks/Types/PaymentMethodWebhook.cs @@ -15,4 +15,7 @@ public class PaymentMethodWebhook [JsonPropertyName("paymentMethod")] public PaymentMethodResponse PaymentMethod { get; init; } + + [JsonPropertyName("entity")] + public EntityResponse Entity { get; init; } }