Skip to content
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
5 changes: 5 additions & 0 deletions GoCardless/GoCardlessClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public partial class GoCardlessClient
/// </summary>
public BankAccountDetailService BankAccountDetails => new BankAccountDetailService(this);

/// <summary>
///A service for working with bank account holder verification resources.
/// </summary>
public BankAccountHolderVerificationService BankAccountHolderVerifications => new BankAccountHolderVerificationService(this);

/// <summary>
///A service for working with bank authorisation resources.
/// </summary>
Expand Down
148 changes: 148 additions & 0 deletions GoCardless/Resources/BankAccountHolderVerification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using GoCardless.Internals;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace GoCardless.Resources
{
/// <summary>
/// Represents a bank account holder verification resource.
///
/// Create a bank account holder verification for a bank account.
/// </summary>
public class BankAccountHolderVerification
{
/// <summary>
/// The actual account name returned by the recipient's bank, populated
/// only in the case of a partial match.
/// </summary>
[JsonProperty("actual_account_name")]
public string ActualAccountName { get; set; }

/// <summary>
/// The unique identifier for the bank account holder verification
/// resource, e.g. "BAHV123".
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// Result of the verification, could be one of
/// <ul>
/// <li>`full_match`: The verification has confirmed that the account
/// name exactly matches the details provided.</li>
/// <li>`partial_match`: The verification has confirmed that the
/// account name is similar but does not match to the details provided.
/// </li>
/// <li>`no_match`: The verification concludes the provided name does
/// not match the account details.</li>
/// <li>`unable_to_match`: The verification could not be performed due
/// to recipient bank issues or technical issues </li>
/// </ul>
/// </summary>
[JsonProperty("result")]
public BankAccountHolderVerificationResult? Result { get; set; }

/// <summary>
/// The status of the bank account holder verification.
/// <ul>
/// <li>`pending`: We have triggered the verification, but the result
/// has not come back yet.</li>
/// <li>`completed`: The verification is complete and is ready to be
/// used.</li>
/// </ul>
///
/// </summary>
[JsonProperty("status")]
public BankAccountHolderVerificationStatus? Status { get; set; }

/// <summary>
/// Type of the verification that has been performed
/// eg. [Confirmation of
/// Payee](https://www.wearepay.uk/what-we-do/overlay-services/confirmation-of-payee/)
/// </summary>
[JsonProperty("type")]
public BankAccountHolderVerificationType? Type { get; set; }
}

/// <summary>
/// Result of the verification, could be one of
/// <ul>
/// <li>`full_match`: The verification has confirmed that the account name exactly matches the
/// details provided.</li>
/// <li>`partial_match`: The verification has confirmed that the account name is similar but
/// does not match to the details provided. </li>
/// <li>`no_match`: The verification concludes the provided name does not match the account
/// details.</li>
/// <li>`unable_to_match`: The verification could not be performed due to recipient bank
/// issues or technical issues </li>
/// </ul>
/// </summary>
[JsonConverter(typeof(GcStringEnumConverter), (int)Unknown)]
public enum BankAccountHolderVerificationResult
{
/// <summary>Unknown status</summary>
[EnumMember(Value = "unknown")]
Unknown = 0,

/// <summary>`result` with a value of "full_match"</summary>
[EnumMember(Value = "full_match")]
FullMatch,

/// <summary>`result` with a value of "partial_match"</summary>
[EnumMember(Value = "partial_match")]
PartialMatch,

/// <summary>`result` with a value of "no_match"</summary>
[EnumMember(Value = "no_match")]
NoMatch,

/// <summary>`result` with a value of "unable_to_match"</summary>
[EnumMember(Value = "unable_to_match")]
UnableToMatch,
}

/// <summary>
/// The status of the bank account holder verification.
/// <ul>
/// <li>`pending`: We have triggered the verification, but the result has not come back
/// yet.</li>
/// <li>`completed`: The verification is complete and is ready to be used.</li>
/// </ul>
///
/// </summary>
[JsonConverter(typeof(GcStringEnumConverter), (int)Unknown)]
public enum BankAccountHolderVerificationStatus
{
/// <summary>Unknown status</summary>
[EnumMember(Value = "unknown")]
Unknown = 0,

/// <summary>`status` with a value of "pending"</summary>
[EnumMember(Value = "pending")]
Pending,

/// <summary>`status` with a value of "completed"</summary>
[EnumMember(Value = "completed")]
Completed,
}

/// <summary>
/// Type of the verification that has been performed
/// eg. [Confirmation of
/// Payee](https://www.wearepay.uk/what-we-do/overlay-services/confirmation-of-payee/)
/// </summary>
[JsonConverter(typeof(GcStringEnumConverter), (int)Unknown)]
public enum BankAccountHolderVerificationType
{
/// <summary>Unknown status</summary>
[EnumMember(Value = "unknown")]
Unknown = 0,

/// <summary>`type` with a value of "confirmation_of_payee"</summary>
[EnumMember(Value = "confirmation_of_payee")]
ConfirmationOfPayee,
}
}
169 changes: 169 additions & 0 deletions GoCardless/Services/BankAccountHolderVerificationService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using GoCardless.Internals;
using GoCardless.Resources;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace GoCardless.Services
{
/// <summary>
/// Service class for working with bank account holder verification resources.
///
/// Create a bank account holder verification for a bank account.
/// </summary>
public class BankAccountHolderVerificationService
{
private readonly GoCardlessClient _goCardlessClient;

/// <summary>
/// Constructor. Users of this library should not call this.
/// An instance of this class can be accessed through an initialised
/// GoCardlessClient.
/// </summary>
public BankAccountHolderVerificationService(GoCardlessClient goCardlessClient)
{
_goCardlessClient = goCardlessClient;
}

/// <summary>
/// Verify the account holder of the bank account. A complete
/// verification can be attached when creating an outbound payment. This
/// endpoint allows partner merchants to create Confirmation of Payee
/// checks on customer bank accounts before sending outbound payments.
/// </summary>
/// <param name="request">An optional `BankAccountHolderVerificationCreateRequest` representing the body for this create request.</param>
/// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param>
/// <returns>A single bank account holder verification resource</returns>
public Task<BankAccountHolderVerificationResponse> CreateAsync(
BankAccountHolderVerificationCreateRequest request = null,
RequestSettings customiseRequestMessage = null
)
{
request = request ?? new BankAccountHolderVerificationCreateRequest();

var urlParams = new List<KeyValuePair<string, object>> { };

return _goCardlessClient.ExecuteAsync<BankAccountHolderVerificationResponse>(
"POST",
"/bank_account_holder_verifications",
urlParams,
request,
id => GetAsync(id, null, customiseRequestMessage),
"bank_account_holder_verifications",
customiseRequestMessage
);
}

/// <summary>
/// Fetches a bank account holder verification by ID.
/// </summary>
/// <param name="identity">The unique identifier for the bank account holder verification
/// resource, e.g. "BAHV123".</param>
/// <param name="request">An optional `BankAccountHolderVerificationGetRequest` representing the query parameters for this get request.</param>
/// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param>
/// <returns>A single bank account holder verification resource</returns>
public Task<BankAccountHolderVerificationResponse> GetAsync(
string identity,
BankAccountHolderVerificationGetRequest request = null,
RequestSettings customiseRequestMessage = null
)
{
request = request ?? new BankAccountHolderVerificationGetRequest();
if (identity == null)
throw new ArgumentException(nameof(identity));

var urlParams = new List<KeyValuePair<string, object>>
{
new KeyValuePair<string, object>("identity", identity),
};

return _goCardlessClient.ExecuteAsync<BankAccountHolderVerificationResponse>(
"GET",
"/bank_account_holder_verifications/:identity",
urlParams,
request,
null,
null,
customiseRequestMessage
);
}
}

/// <summary>
/// Verify the account holder of the bank account. A complete verification
/// can be attached when creating an outbound payment. This endpoint allows
/// partner merchants to create Confirmation of Payee checks on customer
/// bank accounts before sending outbound payments.
/// </summary>
public class BankAccountHolderVerificationCreateRequest : IHasIdempotencyKey
{
/// <summary>
/// Linked resources.
/// </summary>
[JsonProperty("links")]
public BankAccountHolderVerificationLinks Links { get; set; }

/// <summary>
/// Linked resources for a BankAccountHolderVerification.
/// </summary>
public class BankAccountHolderVerificationLinks
{
/// <summary>
/// The ID of the bank account to verify, e.g. "BA123".
/// </summary>
[JsonProperty("bank_account")]
public string BankAccount { get; set; }
}

/// <summary>
/// Type of the verification that has been performed
/// eg. [Confirmation of
/// Payee](https://www.wearepay.uk/what-we-do/overlay-services/confirmation-of-payee/)
/// </summary>
[JsonProperty("type")]
public BankAccountHolderVerificationType? Type { get; set; }

/// <summary>
/// Type of the verification that has been performed
/// eg. [Confirmation of
/// Payee](https://www.wearepay.uk/what-we-do/overlay-services/confirmation-of-payee/)
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum BankAccountHolderVerificationType
{
/// <summary>`type` with a value of "confirmation_of_payee"</summary>
[EnumMember(Value = "confirmation_of_payee")]
ConfirmationOfPayee,
}

/// <summary>
/// A unique key to ensure that this request only succeeds once, allowing you to safely retry request errors such as network failures.
/// Any requests, where supported, to create a resource with a key that has previously been used will not succeed.
/// See: https://developer.gocardless.com/api-reference/#making-requests-idempotency-keys
/// </summary>
[JsonIgnore]
public string IdempotencyKey { get; set; }
}

/// <summary>
/// Fetches a bank account holder verification by ID.
/// </summary>
public class BankAccountHolderVerificationGetRequest { }

/// <summary>
/// An API response for a request returning a single bank account holder verification.
/// </summary>
public class BankAccountHolderVerificationResponse : ApiResponse
{
/// <summary>
/// The bank account holder verification from the response.
/// </summary>
[JsonProperty("bank_account_holder_verifications")]
public BankAccountHolderVerification BankAccountHolderVerification { get; private set; }
}
}
8 changes: 0 additions & 8 deletions GoCardless/Services/OutboundPaymentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,6 @@ public class OutboundPaymentCreateRequest : IHasIdempotencyKey
/// </summary>
public class OutboundPaymentLinks
{
/// <summary>
/// ID of the app that created the outbound payment.
/// <br/>_Note_: this property will only be present if the payment
/// was created through an app.
/// </summary>
[JsonProperty("app")]
public string App { get; set; }

/// <summary>
/// ID of the creditor who sends the outbound payment.
/// </summary>
Expand Down
Loading