-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b00e4a7
commit 6f3d17d
Showing
17 changed files
with
258 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/Mercoa.Client/Entity/Customization/CustomizationClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/Mercoa.Client/Entity/User/requests/EntityFindEntityRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
19
src/Mercoa.Client/EntityTypes/Types/EntityCustomizationRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
19
src/Mercoa.Client/EntityTypes/Types/EntityCustomizationResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
22
src/Mercoa.Client/EntityTypes/Types/FindEntityUserResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Mercoa.Client/EntityTypes/Types/MetadataCustomizationRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Mercoa.Client/EntityTypes/Types/PaymentMethodCustomizationRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/Mercoa.Client/OrganizationTypes/Types/PaymentRailMarkup.cs
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/Mercoa.Client/OrganizationTypes/Types/PaymentRailMarkupType.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters