Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for processor/token/create endpoint #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions src/Plaid/Management/CreateProcessorTokenRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Newtonsoft.Json;

namespace Acklann.Plaid.Management
{
/// <summary>
/// Represents a request for plaid's '/processor/token/create' endpoint. Create a processor_token from an access_token.
/// </summary>
/// <seealso cref="Acklann.Plaid.SerializableContent" />
public class CreateProcessorTokenRequest : SerializableContent
{
/// <summary>
/// Gets or sets the client identifier.
/// </summary>
/// <value>The client identifier.</value>
[JsonProperty("client_id")]
public string ClientId { get; set; }

/// <summary>
/// Gets or sets the secret.
/// </summary>
/// <value>The secret.</value>
[JsonProperty("secret")]
public string Secret { get; set; }

/// <summary>
/// Gets or sets the access_token.
/// </summary>
/// <value>The access token.</value>
[JsonProperty("access_token")]
public string AccessToken { get; set; }

/// <summary>
/// Gets or sets the client_id.
/// </summary>
/// <value>The account identifier.</value>
[JsonProperty("account_id")]
public string AccountId { get; set; }

/// <summary>
/// Gets or sets the client_id.
/// </summary>
/// <value>The processor you are integrating with.</value>
[JsonProperty("processor")]
public string Processor { get; set; }
}
}
18 changes: 18 additions & 0 deletions src/Plaid/Management/CreateProcessorTokenResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

namespace Acklann.Plaid.Management
{
/// <summary>
/// Represents a response from plaid's '/processor/token/create' endpoint. Create a token suitable for sending to one of Plaid's partners to enable integrations.
/// </summary>
/// <seealso cref="Acklann.Plaid.ResponseBase" />
public class CreateProcessorTokenResponse : ResponseBase
{
/// <summary>
/// Gets or sets the processor token.
/// </summary>
/// <value>The processor token.</value>
[JsonProperty("processor_token")]
public string ProcessorToken { get; set; }
}
}
10 changes: 10 additions & 0 deletions src/Plaid/PlaidClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ public PlaidClient(string clientId,
return PostAsync<Management.CreatePublicTokenResponse>("/item/public_token/create", request);
}

/// <summary>
/// Exchanges an access_token for an API Processor_token.
/// </summary>
/// <param name="request">The request.</param>
/// <returns>Task&lt;Management.CreateProcessorTokenResponse&gt;.</returns>
public Task<Management.CreateProcessorTokenResponse> CreateProcessorTokenAsync(Management.CreateProcessorTokenRequest request)
{
return PostAsync<Management.CreateProcessorTokenResponse>("processor/token/create", request);
}

/// <summary>
/// Creates a Link link_token.
/// </summary>
Expand Down