Skip to content

Commit

Permalink
Release v0.3.37
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jun 1, 2024
1 parent b00e4a7 commit 6f3d17d
Show file tree
Hide file tree
Showing 17 changed files with 258 additions and 55 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", "{C7248B78-60ED-4C1D-A405-DFB54E67ACEB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercoa.Client", "Mercoa.Client\Mercoa.Client.csproj", "{4E9723B5-0D4E-4C47-876C-2496478B955E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercoa.Client.Test", "Mercoa.Client.Test\Mercoa.Client.Test.csproj", "{2AC14705-C577-4654-83EF-1B12452A5AED}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mercoa.Client.Test", "Mercoa.Client.Test\Mercoa.Client.Test.csproj", "{730ABA81-798E-4B9B-91C2-F4956628D257}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -16,13 +16,13 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C7248B78-60ED-4C1D-A405-DFB54E67ACEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7248B78-60ED-4C1D-A405-DFB54E67ACEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7248B78-60ED-4C1D-A405-DFB54E67ACEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7248B78-60ED-4C1D-A405-DFB54E67ACEB}.Release|Any CPU.Build.0 = Release|Any CPU
{2AC14705-C577-4654-83EF-1B12452A5AED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2AC14705-C577-4654-83EF-1B12452A5AED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2AC14705-C577-4654-83EF-1B12452A5AED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2AC14705-C577-4654-83EF-1B12452A5AED}.Release|Any CPU.Build.0 = Release|Any CPU
{4E9723B5-0D4E-4C47-876C-2496478B955E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E9723B5-0D4E-4C47-876C-2496478B955E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E9723B5-0D4E-4C47-876C-2496478B955E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E9723B5-0D4E-4C47-876C-2496478B955E}.Release|Any CPU.Build.0 = Release|Any CPU
{730ABA81-798E-4B9B-91C2-F4956628D257}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{730ABA81-798E-4B9B-91C2-F4956628D257}.Debug|Any CPU.Build.0 = Debug|Any CPU
{730ABA81-798E-4B9B-91C2-F4956628D257}.Release|Any CPU.ActiveCfg = Release|Any CPU
{730ABA81-798E-4B9B-91C2-F4956628D257}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
51 changes: 51 additions & 0 deletions src/Mercoa.Client/Entity/Customization/CustomizationClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System.Text.Json;
using Mercoa.Client;

namespace Mercoa.Client.Entity;

public class CustomizationClient
{
private RawClient _client;

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

/// <summary>
/// Get entity customization.
/// </summary>
public async Task<EntityCustomizationResponse> GetAsync()
{
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest { Method = HttpMethod.Get, Path = "/customization" }
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<EntityCustomizationResponse>(responseBody);
}
throw new Exception();
}

/// <summary>
/// Update entity customization. This lets you turn off metadata and payment methods for an entity.
/// </summary>
public async Task<EntityCustomizationResponse> UpdateAsync(EntityCustomizationRequest request)
{
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest
{
Method = HttpMethod.Post,
Path = "/customization",
Body = request
}
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<EntityCustomizationResponse>(responseBody);
}
throw new Exception();
}
}
3 changes: 3 additions & 0 deletions src/Mercoa.Client/Entity/EntityClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public EntityClient(RawClient client)
User = new UserClient(_client);
ApprovalPolicy = new ApprovalPolicyClient(_client);
Counterparty = new CounterpartyClient(_client);
Customization = new CustomizationClient(_client);
ExternalAccountingSystem = new ExternalAccountingSystemClient(_client);
Invoice = new InvoiceClient(_client);
Metadata = new MetadataClient(_client);
Expand All @@ -33,6 +34,8 @@ public EntityClient(RawClient client)

public CounterpartyClient Counterparty { get; }

public CustomizationClient Customization { get; }

public ExternalAccountingSystemClient ExternalAccountingSystem { get; }

public InvoiceClient Invoice { get; }
Expand Down
49 changes: 49 additions & 0 deletions src/Mercoa.Client/Entity/User/UserClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,55 @@ public async Task<List<EntityUserResponse>> GetAllAsync(string entityId)
throw new Exception();
}

/// <summary>
/// Get all entity users
/// </summary>
public async Task<FindEntityUserResponse> FindAsync(
string entityId,
EntityFindEntityRequest request
)
{
var _query = new Dictionary<string, object>() { };
if (request.ForeignId != null)
{
_query["foreignId"] = request.ForeignId;
}
if (request.Role != null)
{
_query["role"] = request.Role;
}
if (request.Name != null)
{
_query["name"] = request.Name;
}
if (request.Email != null)
{
_query["email"] = request.Email;
}
if (request.Limit != null)
{
_query["limit"] = request.Limit;
}
if (request.StartingAfter != null)
{
_query["startingAfter"] = request.StartingAfter;
}
var response = await _client.MakeRequestAsync(
new RawClient.ApiRequest
{
Method = HttpMethod.Put,
Path = $"/{entityId}/users",
Query = _query
}
);
string responseBody = await response.Raw.Content.ReadAsStringAsync();
if (response.StatusCode >= 200 && response.StatusCode < 400)
{
return JsonSerializer.Deserialize<FindEntityUserResponse>(responseBody);
}
throw new Exception();
}

public async Task<EntityUserResponse> CreateAsync(string entityId, EntityUserRequest request)
{
var response = await _client.MakeRequestAsync(
Expand Down
34 changes: 34 additions & 0 deletions src/Mercoa.Client/Entity/User/requests/EntityFindEntityRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace Mercoa.Client.Entity.User;

public class EntityFindEntityRequest
{
/// <summary>
/// ID used to identify user in your system
/// </summary>
public string? ForeignId { get; init; }

/// <summary>
/// Filter users by role. If multiple roles are provided, users with any of the roles will be returned.
/// </summary>
public string? Role { get; init; }

/// <summary>
/// Filter users by name. Partial matches are supported.
/// </summary>
public string? Name { get; init; }

/// <summary>
/// Filter users by email. Partial matches are supported.
/// </summary>
public string? Email { get; init; }

/// <summary>
/// Number of entities to return. Limit can range between 1 and 100, and the default is 10.
/// </summary>
public int? Limit { get; init; }

/// <summary>
/// The ID of the user to start after. If not provided, the first page of entities will be returned.
/// </summary>
public string? StartingAfter { get; init; }
}
19 changes: 19 additions & 0 deletions src/Mercoa.Client/EntityTypes/Types/EntityCustomizationRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Text.Json.Serialization;
using Mercoa.Client;

namespace Mercoa.Client;

public class EntityCustomizationRequest
{
[JsonPropertyName("metadata")]
public List<MetadataCustomizationRequest> Metadata { get; init; }

[JsonPropertyName("paymentSource")]
public List<PaymentMethodCustomizationRequest> PaymentSource { get; init; }

[JsonPropertyName("backupDisbursement")]
public List<PaymentMethodCustomizationRequest> BackupDisbursement { get; init; }

[JsonPropertyName("paymentDestination")]
public List<PaymentMethodCustomizationRequest> PaymentDestination { get; init; }
}
19 changes: 19 additions & 0 deletions src/Mercoa.Client/EntityTypes/Types/EntityCustomizationResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Text.Json.Serialization;
using Mercoa.Client;

namespace Mercoa.Client;

public class EntityCustomizationResponse
{
[JsonPropertyName("metadata")]
public List<MetadataCustomizationRequest> Metadata { get; init; }

[JsonPropertyName("paymentSource")]
public List<PaymentMethodCustomizationRequest> PaymentSource { get; init; }

[JsonPropertyName("backupDisbursement")]
public List<PaymentMethodCustomizationRequest> BackupDisbursement { get; init; }

[JsonPropertyName("paymentDestination")]
public List<PaymentMethodCustomizationRequest> PaymentDestination { get; init; }
}
22 changes: 22 additions & 0 deletions src/Mercoa.Client/EntityTypes/Types/FindEntityUserResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Text.Json.Serialization;
using Mercoa.Client;

namespace Mercoa.Client;

public class FindEntityUserResponse
{
/// <summary>
/// Total number of users for the given filters. This value is not limited by the limit parameter. It is provided so that you can determine how many pages of results are available.
/// </summary>
[JsonPropertyName("count")]
public int Count { get; init; }

/// <summary>
/// True if there are more users available for the given filters.
/// </summary>
[JsonPropertyName("hasMore")]
public bool HasMore { get; init; }

[JsonPropertyName("data")]
public List<EntityUserResponse> Data { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Text.Json.Serialization;

namespace Mercoa.Client;

public class MetadataCustomizationRequest
{
/// <summary>
/// The key of the metadata field. This must be defined at the organization level, otherwise an error will be returned.
/// </summary>
[JsonPropertyName("key")]
public string Key { get; init; }

/// <summary>
/// If true, this field will not be available to the entity.
/// </summary>
[JsonPropertyName("disabled")]
public bool Disabled { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Text.Json.Serialization;
using Mercoa.Client;

namespace Mercoa.Client;

public class PaymentMethodCustomizationRequest
{
[JsonPropertyName("type")]
public PaymentMethodType Type { get; init; }

/// <summary>
/// If type is custom, this is the ID of the schema to use for this payment method.
/// </summary>
[JsonPropertyName("schemaId")]
public string? SchemaId { get; init; }

/// <summary>
/// If true, this method will will not be available to the entity.
/// </summary>
[JsonPropertyName("disabled")]
public bool Disabled { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ public class BankAccountPaymentDestinationOptions
/// </summary>
[JsonPropertyName("delivery")]
public BankDeliveryMethod? Delivery { get; init; }

/// <summary>
/// ACH Statement Description. By default, this will be 'AP' followed by the first 8 characters of the invoice ID. Must be at least 4 characters and no more than 10 characters, and follow this regex pattern ^[a-zA-Z0-9\-#.$&*]{4,10}$
/// </summary>
[JsonPropertyName("description")]
public string? Description { 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 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<NuGetAudit>false</NuGetAudit>
<Version>v0.3.36</Version>
<Version>v0.3.37</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageProjectUrl>https://github.com/mercoa-finance/csharp</PackageProjectUrl>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Mercoa.Client/Mercoa.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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", "v0.3.36" },
{ "X-Fern-SDK-Version", "v0.3.37" },
},
clientOptions ?? new ClientOptions()
);
Expand Down
13 changes: 0 additions & 13 deletions src/Mercoa.Client/OrganizationTypes/Types/PaymentRailMarkup.cs

This file was deleted.

12 changes: 0 additions & 12 deletions src/Mercoa.Client/OrganizationTypes/Types/PaymentRailMarkupType.cs

This file was deleted.

10 changes: 2 additions & 8 deletions src/Mercoa.Client/OrganizationTypes/Types/PaymentRailRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ public class PaymentRailRequest
public PaymentMethodType Type { get; init; }

/// <summary>
/// Name of the payment method. For custom payment methods, this is the ID of the schema.
/// For custom payment methods, this is the ID of the schema.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; init; }

[JsonPropertyName("markup")]
public PaymentRailMarkup? Markup { get; init; }

[JsonPropertyName("description")]
public string? Description { get; init; }
public string? Name { get; init; }

[JsonPropertyName("active")]
public bool Active { get; init; }
Expand Down
11 changes: 1 addition & 10 deletions src/Mercoa.Client/OrganizationTypes/Types/PaymentRailResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,15 @@ namespace Mercoa.Client;

public class PaymentRailResponse
{
[JsonPropertyName("available")]
public bool Available { get; init; }

[JsonPropertyName("type")]
public PaymentMethodType Type { get; init; }

/// <summary>
/// Name of the payment method. For custom payment methods, this is the ID of the schema.
/// For custom payment methods, this is the ID of the schema.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; init; }

[JsonPropertyName("markup")]
public PaymentRailMarkup? Markup { get; init; }

[JsonPropertyName("description")]
public string? Description { get; init; }

[JsonPropertyName("active")]
public bool Active { get; init; }
}

0 comments on commit 6f3d17d

Please sign in to comment.