Skip to content

Commit

Permalink
Merge pull request #131 from gocardless/template-changes
Browse files Browse the repository at this point in the history
Changes from gocardless/gocardless-dotnet-template
  • Loading branch information
jessezach authored May 28, 2024
2 parents c8192a2 + 5e930d2 commit 94df23b
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 21 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>6.2.0</PackageVersion>
<PackageVersion>6.3.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/v6.2.0</PackageReleaseNotes>
<PackageReleaseNotes>https://github.com/gocardless/gocardless-dotnet/releases/tag/v6.3.0</PackageReleaseNotes>
<TargetFrameworks>netstandard1.6;netstandard2.0;netstandard2.1;net46;net8.0</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
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/6.2.0 {runtimeFrameworkInformation} {Helpers.CleanupOSDescriptionString(OSRunningOn)}";
var userAgentInformation = $" gocardless-dotnet/6.3.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", "6.2.0");
requestMessage.Headers.Add("GoCardless-Client-Version", "6.3.0");
requestMessage.Headers.Add("GoCardless-Client-Library", "gocardless-dotnet");
requestMessage.Headers.Authorization =
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _accessToken);
Expand Down
36 changes: 28 additions & 8 deletions GoCardless/Services/LogoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,18 @@ public LogoService(GoCardlessClient goCardlessClient)
/// Creates a new logo associated with a creditor. If a creditor already
/// has a logo, this will update the existing logo linked to the
/// creditor.
/// </summary>
/// <param name="identity">Unique identifier, beginning with "CR".</param>
/// </summary>
/// <param name="request">An optional `LogoCreateForCreditorRequest` representing the body for this create_for_creditor request.</param>
/// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param>
/// <returns>A single logo resource</returns>
public Task<LogoResponse> CreateForCreditorAsync(string identity, LogoCreateForCreditorRequest request = null, RequestSettings customiseRequestMessage = null)
public Task<LogoResponse> CreateForCreditorAsync(LogoCreateForCreditorRequest request = null, RequestSettings customiseRequestMessage = null)
{
request = request ?? new LogoCreateForCreditorRequest();
if (identity == null) throw new ArgumentException(nameof(identity));

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

return _goCardlessClient.ExecuteAsync<LogoResponse>("POST", "/creditors/:identity/branding/logos", urlParams, request, null, "logos", customiseRequestMessage);
return _goCardlessClient.ExecuteAsync<LogoResponse>("POST", "/branding/logos", urlParams, request, null, "logos", customiseRequestMessage);
}
}

Expand All @@ -64,6 +60,30 @@ public Task<LogoResponse> CreateForCreditorAsync(string identity, LogoCreateForC
/// </summary>
public class LogoCreateForCreditorRequest
{

/// <summary>
/// Base64 encoded string.
/// </summary>
[JsonProperty("image")]
public string Image { get; set; }

/// <summary>
/// Linked resources.
/// </summary>
[JsonProperty("links")]
public LogoLinks Links { get; set; }
/// <summary>
/// Linked resources for a Logo.
/// </summary>
public class LogoLinks
{

/// <summary>
/// ID of the creditor the payer theme belongs to
/// </summary>
[JsonProperty("creditor")]
public string Creditor { get; set; }
}
}

/// <summary>
Expand Down
30 changes: 22 additions & 8 deletions GoCardless/Services/PayerThemeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,18 @@ public PayerThemeService(GoCardlessClient goCardlessClient)
/// Creates a new payer theme associated with a creditor. If a creditor
/// already has payer themes, this will update the existing payer theme
/// linked to the creditor.
/// </summary>
/// <param name="identity">Unique identifier, beginning with "CR".</param>
/// </summary>
/// <param name="request">An optional `PayerThemeCreateForCreditorRequest` representing the body for this create_for_creditor request.</param>
/// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param>
/// <returns>A single payer theme resource</returns>
public Task<PayerThemeResponse> CreateForCreditorAsync(string identity, PayerThemeCreateForCreditorRequest request = null, RequestSettings customiseRequestMessage = null)
public Task<PayerThemeResponse> CreateForCreditorAsync(PayerThemeCreateForCreditorRequest request = null, RequestSettings customiseRequestMessage = null)
{
request = request ?? new PayerThemeCreateForCreditorRequest();
if (identity == null) throw new ArgumentException(nameof(identity));

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

return _goCardlessClient.ExecuteAsync<PayerThemeResponse>("POST", "/creditors/:identity/branding/payer_themes", urlParams, request, null, "payer_themes", customiseRequestMessage);
return _goCardlessClient.ExecuteAsync<PayerThemeResponse>("POST", "/branding/payer_themes", urlParams, request, null, "payer_themes", customiseRequestMessage);
}
}

Expand Down Expand Up @@ -87,6 +83,24 @@ public class PayerThemeCreateForCreditorRequest
/// </summary>
[JsonProperty("link_text_colour")]
public string LinkTextColour { get; set; }

/// <summary>
/// Linked resources.
/// </summary>
[JsonProperty("links")]
public PayerThemeLinks Links { get; set; }
/// <summary>
/// Linked resources for a PayerTheme.
/// </summary>
public class PayerThemeLinks
{

/// <summary>
/// ID of the creditor the payer theme belongs to
/// </summary>
[JsonProperty("creditor")]
public string Creditor { get; set; }
}
}

/// <summary>
Expand Down
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 6.2.0`
`Install-Package GoCardless -Version 6.3.0`


## Usage
Expand Down

0 comments on commit 94df23b

Please sign in to comment.