Skip to content

Commit

Permalink
Merge pull request #109 from gocardless/template-changes
Browse files Browse the repository at this point in the history
Template changes
  • Loading branch information
kevthanewversi authored Dec 11, 2023
2 parents 07edf8e + 6b652d1 commit 4e875ec
Show file tree
Hide file tree
Showing 11 changed files with 211 additions and 7 deletions.
4 changes: 2 additions & 2 deletions GoCardless/GoCardless.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageId>GoCardless</PackageId>
<PackageVersion>5.18.0</PackageVersion>
<PackageVersion>5.19.0</PackageVersion>
<Authors>GoCardless Ltd</Authors>
<Description>Client for the GoCardless API - a powerful, simple solution for the collection of recurring bank-to-bank payments</Description>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
Expand All @@ -11,7 +11,7 @@
<Copyright>GoCardless Ltd</Copyright>
<PackageTags>gocardless payments rest api direct debit</PackageTags>
<PackageLicenseUrl>https://github.com/gocardless/gocardless-dotnet/blob/master/LICENSE.txt</PackageLicenseUrl>
<PackageReleaseNotes>https://github.com/gocardless/gocardless-dotnet/releases/tag/v5.18.0</PackageReleaseNotes>
<PackageReleaseNotes>https://github.com/gocardless/gocardless-dotnet/releases/tag/v5.19.0</PackageReleaseNotes>
<TargetFrameworks>netstandard1.6;netstandard2.0;net46</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
5 changes: 5 additions & 0 deletions GoCardless/GoCardlessClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ public partial class GoCardlessClient
/// </summary>
public TaxRateService TaxRates => new TaxRateService(this);

/// <summary>
///A service for working with transferred mandate resources.
/// </summary>
public TransferredMandateService TransferredMandates => new TransferredMandateService(this);

/// <summary>
///A service for working with verification detail resources.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions GoCardless/GoCardlessClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ private HttpRequestMessage BuildHttpRequestMessage<T>(string method, string path
runtimeFrameworkInformation = System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion();
#endif

var userAgentInformation = $" gocardless-dotnet/5.18.0 {runtimeFrameworkInformation} {Helpers.CleanupOSDescriptionString(OSRunningOn)}";
var userAgentInformation = $" gocardless-dotnet/5.19.0 {runtimeFrameworkInformation} {Helpers.CleanupOSDescriptionString(OSRunningOn)}";

requestMessage.Headers.Add("User-Agent", userAgentInformation);
requestMessage.Headers.Add("GoCardless-Version", "2015-07-06");
requestMessage.Headers.Add("GoCardless-Client-Version", "5.18.0");
requestMessage.Headers.Add("GoCardless-Client-Version", "5.19.0");
requestMessage.Headers.Add("GoCardless-Client-Library", "gocardless-dotnet");
requestMessage.Headers.Authorization =
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _accessToken);
Expand Down
6 changes: 6 additions & 0 deletions GoCardless/Resources/BillingRequestFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public class BillingRequestFlow
[JsonProperty("created_at")]
public DateTimeOffset? CreatedAt { get; set; }

/// <summary>
/// Identifies whether a Billing Request belongs to a specific customer
/// </summary>
[JsonProperty("customer_details_captured")]
public bool? CustomerDetailsCaptured { get; set; }

/// <summary>
/// URL that the payer can be taken to if there isn't a way to progress
/// ahead in flow.
Expand Down
16 changes: 15 additions & 1 deletion GoCardless/Resources/BillingRequestTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,21 @@ namespace GoCardless.Resources
/// <summary>
/// Represents a billing request template resource.
///
/// Billing Request Templates
/// Billing Request Templates are reusable templates that result in
/// numerous Billing Requests with similar attributes. They provide
/// a no-code solution for generating various types of multi-user payment
/// links.
///
/// Each template includes a reusable URL that can be embedded in a website
/// or shared with customers via email. Every time the URL is opened,
/// it generates a new Billing Request.
///
/// Billing Request Templates overcome the key limitation of the Billing
/// Request:
/// a Billing Request cannot be shared among multiple users because it is
/// intended
/// for single-use and is designed to cater to the unique needs of
/// individual customers.
/// </summary>
public class BillingRequestTemplate
{
Expand Down
66 changes: 66 additions & 0 deletions GoCardless/Resources/TransferredMandate.cs
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; }
}

}
6 changes: 6 additions & 0 deletions GoCardless/Services/BillingRequestFlowService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ public class BillingRequestFlowCreateRequest
[JsonProperty("auto_fulfil")]
public bool? AutoFulfil { get; set; }

/// <summary>
/// Identifies whether a Billing Request belongs to a specific customer
/// </summary>
[JsonProperty("customer_details_captured")]
public bool? CustomerDetailsCaptured { get; set; }

/// <summary>
/// URL that the payer can be taken to if there isn't a way to progress
/// ahead in flow.
Expand Down
15 changes: 15 additions & 0 deletions GoCardless/Services/BillingRequestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public Task<BillingRequestResponse> CollectCustomerDetailsAsync(string identity,
/// creating
/// and attaching it.
///
/// If the scheme is PayTo and the pay_id is available, this can be
/// included in the payload along with the
/// country_code.
///
/// _ACH scheme_ For compliance reasons, an extra validation step is
/// done using
/// a third-party provider to make sure the customer's bank account can
Expand Down Expand Up @@ -1054,6 +1058,10 @@ public class BillingRequestCustomerBillingDetail
/// the bank account is valid for the billing request scheme before creating
/// and attaching it.
///
/// If the scheme is PayTo and the pay_id is available, this can be included
/// in the payload along with the
/// country_code.
///
/// _ACH scheme_ For compliance reasons, an extra validation step is done
/// using
/// a third-party provider to make sure the customer's bank account can
Expand Down Expand Up @@ -1164,6 +1172,13 @@ public enum BillingRequestAccountType
/// </summary>
[JsonProperty("metadata")]
public IDictionary<String, String> Metadata { get; set; }

/// <summary>
/// A unique record such as an email address, mobile number or company
/// number, that can be used to make and accept payments.
/// </summary>
[JsonProperty("pay_id")]
public string PayId { get; set; }
}


Expand Down
16 changes: 15 additions & 1 deletion GoCardless/Services/BillingRequestTemplateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,21 @@ namespace GoCardless.Services
/// <summary>
/// Service class for working with billing request template resources.
///
/// Billing Request Templates
/// Billing Request Templates are reusable templates that result in
/// numerous Billing Requests with similar attributes. They provide
/// a no-code solution for generating various types of multi-user payment
/// links.
///
/// Each template includes a reusable URL that can be embedded in a website
/// or shared with customers via email. Every time the URL is opened,
/// it generates a new Billing Request.
///
/// Billing Request Templates overcome the key limitation of the Billing
/// Request:
/// a Billing Request cannot be shared among multiple users because it is
/// intended
/// for single-use and is designed to cater to the unique needs of
/// individual customers.
/// </summary>

public class BillingRequestTemplateService
Expand Down
78 changes: 78 additions & 0 deletions GoCardless/Services/TransferredMandateService.cs
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; }
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For full details of the GoCardless API, see the [API docs](https://developer.goc

To install `GoCardless`, run the following command in the [Package Manager Console](https://docs.microsoft.com/en-us/nuget/tools/package-manager-console)

`Install-Package GoCardless -Version 5.18.0`
`Install-Package GoCardless -Version 5.19.0`


## Usage
Expand Down

0 comments on commit 4e875ec

Please sign in to comment.