From dc1a6b1488a3f12e7a1d52664e642699ed7d1f89 Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 21 Dec 2022 03:13:55 +0100 Subject: [PATCH] Adding support for processor/token/create endpoint --- .../Management/CreateProcessorTokenRequest.cs | 46 +++++++++++++++++++ .../CreateProcessorTokenResponse.cs | 18 ++++++++ src/Plaid/PlaidClient.cs | 10 ++++ 3 files changed, 74 insertions(+) create mode 100644 src/Plaid/Management/CreateProcessorTokenRequest.cs create mode 100644 src/Plaid/Management/CreateProcessorTokenResponse.cs diff --git a/src/Plaid/Management/CreateProcessorTokenRequest.cs b/src/Plaid/Management/CreateProcessorTokenRequest.cs new file mode 100644 index 0000000..64776a3 --- /dev/null +++ b/src/Plaid/Management/CreateProcessorTokenRequest.cs @@ -0,0 +1,46 @@ +using Newtonsoft.Json; + +namespace Acklann.Plaid.Management +{ + /// + /// Represents a request for plaid's '/processor/token/create' endpoint. Create a processor_token from an access_token. + /// + /// + public class CreateProcessorTokenRequest : SerializableContent + { + /// + /// Gets or sets the client identifier. + /// + /// The client identifier. + [JsonProperty("client_id")] + public string ClientId { get; set; } + + /// + /// Gets or sets the secret. + /// + /// The secret. + [JsonProperty("secret")] + public string Secret { get; set; } + + /// + /// Gets or sets the access_token. + /// + /// The access token. + [JsonProperty("access_token")] + public string AccessToken { get; set; } + + /// + /// Gets or sets the client_id. + /// + /// The account identifier. + [JsonProperty("account_id")] + public string AccountId { get; set; } + + /// + /// Gets or sets the client_id. + /// + /// The processor you are integrating with. + [JsonProperty("processor")] + public string Processor { get; set; } + } +} diff --git a/src/Plaid/Management/CreateProcessorTokenResponse.cs b/src/Plaid/Management/CreateProcessorTokenResponse.cs new file mode 100644 index 0000000..cf4cbdc --- /dev/null +++ b/src/Plaid/Management/CreateProcessorTokenResponse.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace Acklann.Plaid.Management +{ + /// + /// 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. + /// + /// + public class CreateProcessorTokenResponse : ResponseBase + { + /// + /// Gets or sets the processor token. + /// + /// The processor token. + [JsonProperty("processor_token")] + public string ProcessorToken { get; set; } + } +} diff --git a/src/Plaid/PlaidClient.cs b/src/Plaid/PlaidClient.cs index b9ca2f1..eeeb6d1 100644 --- a/src/Plaid/PlaidClient.cs +++ b/src/Plaid/PlaidClient.cs @@ -147,6 +147,16 @@ public PlaidClient(string clientId, return PostAsync("/item/public_token/create", request); } + /// + /// Exchanges an access_token for an API Processor_token. + /// + /// The request. + /// Task<Management.CreateProcessorTokenResponse>. + public Task CreateProcessorTokenAsync(Management.CreateProcessorTokenRequest request) + { + return PostAsync("processor/token/create", request); + } + /// /// Creates a Link link_token. ///