Skip to content

Commit

Permalink
Release 0.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jul 10, 2024
1 parent 31f553d commit 8cb9ab4
Show file tree
Hide file tree
Showing 18 changed files with 231 additions and 52 deletions.
20 changes: 10 additions & 10 deletions src/Mercoa.Client.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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", "{E45AFEF3-BB0F-4EAC-84AE-C320336989B5}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercoa.Client", "Mercoa.Client\Mercoa.Client.csproj", "{CE081D38-C218-43CE-AD19-4B30181A77B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercoa.Client.Test", "Mercoa.Client.Test\Mercoa.Client.Test.csproj", "{158C4704-85C7-4A11-B7FB-FA0FB33AABC1}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercoa.Client.Test", "Mercoa.Client.Test\Mercoa.Client.Test.csproj", "{4FE26769-DFD3-4664-95BA-9C248A0E38A0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -16,13 +16,13 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E45AFEF3-BB0F-4EAC-84AE-C320336989B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E45AFEF3-BB0F-4EAC-84AE-C320336989B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E45AFEF3-BB0F-4EAC-84AE-C320336989B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E45AFEF3-BB0F-4EAC-84AE-C320336989B5}.Release|Any CPU.Build.0 = Release|Any CPU
{158C4704-85C7-4A11-B7FB-FA0FB33AABC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{158C4704-85C7-4A11-B7FB-FA0FB33AABC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{158C4704-85C7-4A11-B7FB-FA0FB33AABC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{158C4704-85C7-4A11-B7FB-FA0FB33AABC1}.Release|Any CPU.Build.0 = Release|Any CPU
{CE081D38-C218-43CE-AD19-4B30181A77B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE081D38-C218-43CE-AD19-4B30181A77B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE081D38-C218-43CE-AD19-4B30181A77B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE081D38-C218-43CE-AD19-4B30181A77B5}.Release|Any CPU.Build.0 = Release|Any CPU
{4FE26769-DFD3-4664-95BA-9C248A0E38A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FE26769-DFD3-4664-95BA-9C248A0E38A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FE26769-DFD3-4664-95BA-9C248A0E38A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FE26769-DFD3-4664-95BA-9C248A0E38A0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
60 changes: 60 additions & 0 deletions src/Mercoa.Client/Calculate/CalculateClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System.Text.Json;
using Mercoa.Client;

#nullable enable

namespace Mercoa.Client;

public class CalculateClient
{
private RawClient _client;

public CalculateClient(RawClient client)
{
_client = client;
}

/// <summary>
/// Calculate the estimated fees associated with an payment given the amount, payment source, and disbursement method. Can be used to calculate fees for a payment before creating an invoice.
/// </summary>
public async Task<InvoiceFeesResponse> FeeAsync(CalculateFeesRequest request)
{
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest
{
Method = HttpMethod.Post,
Path = "/fees",
Body = request
}
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<InvoiceFeesResponse>(responseBody);
}
throw new Exception(responseBody);
}

/// <summary>
/// Calculate the estimated payment timing given the deduction date, payment source, and disbursement method. Can be used to calculate timing for a payment.
/// </summary>
public async Task<CalculatePaymentTimingResponse> PaymentTimingAsync(
CalculatePaymentTimingRequest request
)
{
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest
{
Method = HttpMethod.Post,
Path = "/paymentTiming",
Body = request
}
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<CalculatePaymentTimingResponse>(responseBody);
}
throw new Exception(responseBody);
}
}
39 changes: 39 additions & 0 deletions src/Mercoa.Client/Calculate/Types/CalculatePaymentTimingRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Text.Json.Serialization;
using Mercoa.Client;

#nullable enable

namespace Mercoa.Client;

public class CalculatePaymentTimingRequest
{
/// <summary>
/// Date the payment is scheduled to be deducted from the payer's account. Use this field if the payment has not yet been deducted.
/// </summary>
[JsonPropertyName("estimatedDeductionDate")]
public DateTime? EstimatedDeductionDate { get; init; }

/// <summary>
/// Date the payment was processed. Use this field if the payment has already been deducted.
/// </summary>
[JsonPropertyName("processedAt")]
public DateTime? ProcessedAt { get; init; }

/// <summary>
/// ID of payment source.
/// </summary>
[JsonPropertyName("paymentSourceId")]
public string PaymentSourceId { get; init; }

/// <summary>
/// ID of payment destination.
/// </summary>
[JsonPropertyName("paymentDestinationId")]
public string PaymentDestinationId { get; init; }

/// <summary>
/// Options for the payment destination. Depending on the payment destination, this may include things such as check delivery method.
/// </summary>
[JsonPropertyName("paymentDestinationOptions")]
public PaymentDestinationOptions? PaymentDestinationOptions { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Text.Json.Serialization;

#nullable enable

namespace Mercoa.Client;

public class CalculatePaymentTimingResponse
{
/// <summary>
/// Estimated date the payment will be or was processed.
/// </summary>
[JsonPropertyName("estimatedProcessingDate")]
public DateTime EstimatedProcessingDate { get; init; }

/// <summary>
/// Number of business days between the estimated processing date and the estimated settlement date. This does not take into account bank holidays or weekends.
/// </summary>
[JsonPropertyName("businessDays")]
public int BusinessDays { get; init; }

/// <summary>
/// Estimated payment time in days. This time takes into account bank holidays and weekends.
/// </summary>
[JsonPropertyName("estimatedProcessingTime")]
public int EstimatedProcessingTime { get; init; }

/// <summary>
/// Estimated date the payment will be or was settled. This is the same as the request's deductionDate plus the paymentTiming.
/// </summary>
[JsonPropertyName("estimatedSettlementDate")]
public DateTime EstimatedSettlementDate { get; init; }
}
6 changes: 6 additions & 0 deletions src/Mercoa.Client/EntityTypes/Types/BusinessProfileRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,10 @@ public class BusinessProfileRequest
/// </summary>
[JsonPropertyName("formationDate")]
public DateTime? FormationDate { get; init; }

/// <summary>
/// Industry code for the business. Required to collect funds.
/// </summary>
[JsonPropertyName("industryCodes")]
public IndustryCodes? IndustryCodes { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ public class BusinessProfileResponse

[JsonPropertyName("taxIDProvided")]
public bool TaxIdProvided { get; init; }

[JsonPropertyName("industryCodes")]
public IndustryCodes? IndustryCodes { get; init; }
}
11 changes: 11 additions & 0 deletions src/Mercoa.Client/EntityTypes/Types/IndustryCodes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Text.Json.Serialization;

#nullable enable

namespace Mercoa.Client;

public class IndustryCodes
{
[JsonPropertyName("mcc")]
public string? Mcc { get; init; }
}
37 changes: 0 additions & 37 deletions src/Mercoa.Client/Fees/FeesClient.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,10 @@ public class InvoiceCreationRequest
/// </summary>
[JsonPropertyName("failureType")]
public InvoiceFailureType? FailureType { get; init; }

/// <summary>
/// If using a custom payment method, you can override the default fees for this invoice. If not provided, the default fees for the custom payment method will be used.
/// </summary>
[JsonPropertyName("fees")]
public InvoiceFeesRequest? Fees { get; init; }
}
20 changes: 20 additions & 0 deletions src/Mercoa.Client/InvoiceTypes/Types/InvoiceFeesRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Text.Json.Serialization;

#nullable enable

namespace Mercoa.Client;

public class InvoiceFeesRequest
{
/// <summary>
/// Fee charged to the payer (C2).
/// </summary>
[JsonPropertyName("sourcePlatformMarkupFee")]
public double SourcePlatformMarkupFee { get; init; }

/// <summary>
/// Fee charged to the payee (C3).
/// </summary>
[JsonPropertyName("destinationPlatformMarkupFee")]
public double DestinationPlatformMarkupFee { get; init; }
}
6 changes: 6 additions & 0 deletions src/Mercoa.Client/InvoiceTypes/Types/InvoiceRequestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,10 @@ public class InvoiceRequestBase
/// </summary>
[JsonPropertyName("failureType")]
public InvoiceFailureType? FailureType { get; init; }

/// <summary>
/// If using a custom payment method, you can override the default fees for this invoice. If not provided, the default fees for the custom payment method will be used.
/// </summary>
[JsonPropertyName("fees")]
public InvoiceFeesRequest? Fees { get; init; }
}
6 changes: 6 additions & 0 deletions src/Mercoa.Client/InvoiceTypes/Types/InvoiceUpdateRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,10 @@ public class InvoiceUpdateRequest
/// </summary>
[JsonPropertyName("failureType")]
public InvoiceFailureType? FailureType { get; init; }

/// <summary>
/// If using a custom payment method, you can override the default fees for this invoice. If not provided, the default fees for the custom payment method will be used.
/// </summary>
[JsonPropertyName("fees")]
public InvoiceFeesRequest? Fees { get; init; }
}
2 changes: 1 addition & 1 deletion src/Mercoa.Client/Mercoa.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0;net4.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<NuGetAudit>false</NuGetAudit>
<Version>0.4.5</Version>
<Version>0.4.6</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageProjectUrl>https://github.com/mercoa-finance/csharp</PackageProjectUrl>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Mercoa.Client/Mercoa.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,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.5" },
{ "X-Fern-SDK-Version", "0.4.6" },
},
clientOptions ?? new ClientOptions()
);
Expand All @@ -29,12 +29,12 @@ public Mercoa(string token = null, ClientOptions clientOptions = null)
Invoice = new InvoiceClient(_client);
Organization = new OrganizationClient(_client);
BankLookup = new BankLookupClient(_client);
Calculate = new CalculateClient(_client);
Commons = new CommonsClient(_client);
CustomPaymentMethodSchema = new CustomPaymentMethodSchemaClient(_client);
EmailLogTypes = new EmailLogTypesClient(_client);
EntityGroupTypes = new EntityGroupTypesClient(_client);
EntityTypes = new EntityTypesClient(_client);
Fees = new FeesClient(_client);
InvoiceTypes = new InvoiceTypesClient(_client);
Ocr = new OcrClient(_client);
OrganizationTypes = new OrganizationTypesClient(_client);
Expand All @@ -52,6 +52,8 @@ public Mercoa(string token = null, ClientOptions clientOptions = null)

public BankLookupClient BankLookup { get; }

public CalculateClient Calculate { get; }

public CommonsClient Commons { get; }

public CustomPaymentMethodSchemaClient CustomPaymentMethodSchema { get; }
Expand All @@ -62,8 +64,6 @@ public Mercoa(string token = null, ClientOptions clientOptions = null)

public EntityTypesClient EntityTypes { get; }

public FeesClient Fees { get; }

public InvoiceTypesClient InvoiceTypes { get; }

public OcrClient Ocr { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class BusinessOnboardingOptions
[JsonPropertyName("ein")]
public OnboardingOption Ein { get; init; }

[JsonPropertyName("mcc")]
public OnboardingOption Mcc { get; init; }

[JsonPropertyName("address")]
public OnboardingOption Address { get; init; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ public class CustomPaymentMethodSchemaRequest
[JsonPropertyName("estimatedProcessingTime")]
public int? EstimatedProcessingTime { get; init; }

/// <summary>
/// The maximum amount that can be transferred from this payment method in a single transaction.
/// </summary>
[JsonPropertyName("maxAmount")]
public double? MaxAmount { get; init; }

/// <summary>
/// The minimum amount that can be transferred from this payment method in a single transaction. Default is 1.
/// </summary>
[JsonPropertyName("minAmount")]
public double? MinAmount { get; init; }

[JsonPropertyName("fees")]
public CustomPaymentMethodSchemaFee? Fees { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ public class CustomPaymentMethodSchemaResponse
[JsonPropertyName("estimatedProcessingTime")]
public int EstimatedProcessingTime { get; init; }

/// <summary>
/// The maximum amount that can be transferred from this payment method in a single transaction.
/// </summary>
[JsonPropertyName("maxAmount")]
public double? MaxAmount { get; init; }

/// <summary>
/// The minimum amount that can be transferred from this payment method in a single transaction. Default is 1.
/// </summary>
[JsonPropertyName("minAmount")]
public double? MinAmount { get; init; }

[JsonPropertyName("fees")]
public CustomPaymentMethodSchemaFee? Fees { get; init; }

Expand Down

0 comments on commit 8cb9ab4

Please sign in to comment.