-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from gocardless/template-changes
Template changes
- Loading branch information
Showing
11 changed files
with
211 additions
and
7 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
using GoCardless.Internals; | ||
|
||
namespace GoCardless.Resources | ||
{ | ||
|
||
/// <summary> | ||
/// Represents a transferred mandate resource. | ||
/// | ||
/// Mandates that have been transferred using Current Account Switch Service | ||
/// </summary> | ||
public class TransferredMandate | ||
{ | ||
/// <summary> | ||
/// Encrypted customer bank account details, containing: | ||
/// `iban`, `account_holder_name`, `swift_bank_code`, | ||
/// `swift_branch_code`, `swift_account_number` | ||
/// </summary> | ||
[JsonProperty("encrypted_customer_bank_details")] | ||
public string EncryptedCustomerBankDetails { get; set; } | ||
|
||
/// <summary> | ||
/// Random AES-256 key used to encrypt bank account details, itself | ||
/// encrypted with your public key. | ||
/// </summary> | ||
[JsonProperty("encrypted_decryption_key")] | ||
public string EncryptedDecryptionKey { get; set; } | ||
|
||
/// <summary> | ||
/// Resources linked to this TransferredMandate. | ||
/// </summary> | ||
[JsonProperty("links")] | ||
public TransferredMandateLinks Links { get; set; } | ||
|
||
/// <summary> | ||
/// The ID of an RSA-2048 public key, from your JWKS, used to encrypt | ||
/// the AES key. | ||
/// </summary> | ||
[JsonProperty("public_key_id")] | ||
public string PublicKeyId { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Resources linked to this TransferredMandate | ||
/// </summary> | ||
public class TransferredMandateLinks | ||
{ | ||
/// <summary> | ||
/// The ID of the updated | ||
/// [customer_bank_account](#core-endpoints-customer-bank-accounts) | ||
/// </summary> | ||
[JsonProperty("customer_bank_account")] | ||
public string CustomerBankAccount { get; set; } | ||
|
||
/// <summary> | ||
/// The ID of the transferred mandate | ||
/// </summary> | ||
[JsonProperty("mandate")] | ||
public string Mandate { get; set; } | ||
} | ||
|
||
} |
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
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,78 @@ | ||
|
||
|
||
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 transferred mandate resources. | ||
/// | ||
/// Mandates that have been transferred using Current Account Switch Service | ||
/// </summary> | ||
|
||
public class TransferredMandateService | ||
{ | ||
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 TransferredMandateService(GoCardlessClient goCardlessClient) | ||
{ | ||
_goCardlessClient = goCardlessClient; | ||
} | ||
|
||
/// <summary> | ||
/// Returns new customer bank details for a mandate that's been recently | ||
/// transferred | ||
/// </summary> | ||
/// <param name="identity">Unique identifier, beginning with "MD". Note that this prefix may | ||
/// not apply to mandates created before 2016.</param> | ||
/// <param name="request">An optional `TransferredMandateTransferredMandatesRequest` representing the query parameters for this transferred_mandates request.</param> | ||
/// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param> | ||
/// <returns>A single transferred mandate resource</returns> | ||
public Task<TransferredMandateResponse> TransferredMandatesAsync(string identity, TransferredMandateTransferredMandatesRequest request = null, RequestSettings customiseRequestMessage = null) | ||
{ | ||
request = request ?? new TransferredMandateTransferredMandatesRequest(); | ||
if (identity == null) throw new ArgumentException(nameof(identity)); | ||
|
||
var urlParams = new List<KeyValuePair<string, object>> | ||
{ | ||
new KeyValuePair<string, object>("identity", identity), | ||
}; | ||
|
||
return _goCardlessClient.ExecuteAsync<TransferredMandateResponse>("GET", "/transferred_mandates/:identity", urlParams, request, null, null, customiseRequestMessage); | ||
} | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Returns new customer bank details for a mandate that's been recently | ||
/// transferred | ||
/// </summary> | ||
public class TransferredMandateTransferredMandatesRequest | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// An API response for a request returning a single transferred mandate. | ||
/// </summary> | ||
public class TransferredMandateResponse : ApiResponse | ||
{ | ||
/// <summary> | ||
/// The transferred mandate from the response. | ||
/// </summary> | ||
[JsonProperty("transferred_mandates")] | ||
public TransferredMandate TransferredMandate { get; private set; } | ||
} | ||
} |
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