-
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 #129 from gocardless/template-changes
Changes from gocardless/gocardless-dotnet-template
- Loading branch information
Showing
8 changed files
with
250 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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 logo resource. | ||
/// | ||
/// Logos are image uploads that, when associated with a creditor, are shown | ||
/// on the [billing request flow](#billing-requests-billing-request-flows) | ||
/// payment pages. | ||
/// </summary> | ||
public class Logo | ||
{ | ||
/// <summary> | ||
/// Unique identifier, beginning with "LO". | ||
/// </summary> | ||
[JsonProperty("id")] | ||
public string Id { 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
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 payer theme resource. | ||
/// | ||
/// Custom colour themes for payment pages and customer notifications. | ||
/// </summary> | ||
public class PayerTheme | ||
{ | ||
/// <summary> | ||
/// Unique identifier, beginning with "PTH". | ||
/// </summary> | ||
[JsonProperty("id")] | ||
public string Id { 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
|
||
|
||
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 logo resources. | ||
/// | ||
/// Logos are image uploads that, when associated with a creditor, are shown | ||
/// on the [billing request flow](#billing-requests-billing-request-flows) | ||
/// payment pages. | ||
/// </summary> | ||
|
||
public class LogoService | ||
{ | ||
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 LogoService(GoCardlessClient goCardlessClient) | ||
{ | ||
_goCardlessClient = goCardlessClient; | ||
} | ||
|
||
/// <summary> | ||
/// 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> | ||
/// <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) | ||
{ | ||
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); | ||
} | ||
} | ||
|
||
|
||
/// <summary> | ||
/// 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> | ||
public class LogoCreateForCreditorRequest | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// An API response for a request returning a single logo. | ||
/// </summary> | ||
public class LogoResponse : ApiResponse | ||
{ | ||
/// <summary> | ||
/// The logo from the response. | ||
/// </summary> | ||
[JsonProperty("logos")] | ||
public Logo Logo { 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
|
||
|
||
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 payer theme resources. | ||
/// | ||
/// Custom colour themes for payment pages and customer notifications. | ||
/// </summary> | ||
|
||
public class PayerThemeService | ||
{ | ||
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 PayerThemeService(GoCardlessClient goCardlessClient) | ||
{ | ||
_goCardlessClient = goCardlessClient; | ||
} | ||
|
||
/// <summary> | ||
/// 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> | ||
/// <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) | ||
{ | ||
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); | ||
} | ||
} | ||
|
||
|
||
/// <summary> | ||
/// 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> | ||
public class PayerThemeCreateForCreditorRequest | ||
{ | ||
|
||
/// <summary> | ||
/// Colour for buttons background (hexcode) | ||
/// </summary> | ||
[JsonProperty("button_background_colour")] | ||
public string ButtonBackgroundColour { get; set; } | ||
|
||
/// <summary> | ||
/// Colour for content box border (hexcode) | ||
/// </summary> | ||
[JsonProperty("content_box_border_colour")] | ||
public string ContentBoxBorderColour { get; set; } | ||
|
||
/// <summary> | ||
/// Colour for header background (hexcode) | ||
/// </summary> | ||
[JsonProperty("header_background_colour")] | ||
public string HeaderBackgroundColour { get; set; } | ||
|
||
/// <summary> | ||
/// Colour for text links (hexcode) | ||
/// </summary> | ||
[JsonProperty("link_text_colour")] | ||
public string LinkTextColour { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// An API response for a request returning a single payer theme. | ||
/// </summary> | ||
public class PayerThemeResponse : ApiResponse | ||
{ | ||
/// <summary> | ||
/// The payer theme from the response. | ||
/// </summary> | ||
[JsonProperty("payer_themes")] | ||
public PayerTheme PayerTheme { 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