Skip to content

Commit

Permalink
Merge pull request #136 from gocardless/template-changes
Browse files Browse the repository at this point in the history
Changes from gocardless/gocardless-dotnet-template
  • Loading branch information
prolific117 committed Sep 23, 2024
2 parents 7905ff6 + bf06e76 commit ebf2f8c
Show file tree
Hide file tree
Showing 11 changed files with 450 additions and 22 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.7.0</PackageVersion>
<PackageVersion>7.0.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.7.0</PackageReleaseNotes>
<PackageReleaseNotes>https://github.com/gocardless/gocardless-dotnet/releases/tag/v7.0.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.7.0 {runtimeFrameworkInformation} {Helpers.CleanupOSDescriptionString(OSRunningOn)}";
var userAgentInformation = $" gocardless-dotnet/7.0.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.7.0");
requestMessage.Headers.Add("GoCardless-Client-Version", "7.0.0");
requestMessage.Headers.Add("GoCardless-Client-Library", "gocardless-dotnet");
requestMessage.Headers.Authorization =
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _accessToken);
Expand Down
199 changes: 199 additions & 0 deletions GoCardless/Resources/BillingRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ public class BillingRequest
/// </summary>
[JsonProperty("status")]
public string Status { get; set; }

/// <summary>
/// Request for a subscription
/// </summary>
[JsonProperty("subscription_request")]
public BillingRequestSubscriptionRequest SubscriptionRequest { get; set; }
}

/// <summary>
Expand Down Expand Up @@ -466,6 +472,12 @@ public class BillingRequestLinks
/// </summary>
[JsonProperty("payment_request_payment")]
public string PaymentRequestPayment { get; set; }

/// <summary>
/// (Optional) ID of the associated subscription request
/// </summary>
[JsonProperty("subscription_request")]
public string SubscriptionRequest { get; set; }
}

/// <summary>
Expand Down Expand Up @@ -1116,6 +1128,14 @@ public class BillingRequestResourcesCustomerBankAccount
[JsonProperty("account_type")]
public BillingRequestResourcesCustomerBankAccountAccountType? AccountType { get; set; }

/// <summary>
/// A token to uniquely refer to a set of bank account details. This
/// feature is still in early access and is only available for certain
/// organisations.
/// </summary>
[JsonProperty("bank_account_token")]
public string BankAccountToken { get; set; }

/// <summary>
/// Name of bank, taken from the bank details.
/// </summary>
Expand Down Expand Up @@ -1341,4 +1361,183 @@ public enum BillingRequestStatus {
Cancelled,
}

/// <summary>
/// Represents a billing request subscription request resource.
///
/// Request for a subscription
/// </summary>
public class BillingRequestSubscriptionRequest
{
/// <summary>
/// Amount in the lowest denomination for the currency (e.g. pence in
/// GBP, cents in EUR).
/// </summary>
[JsonProperty("amount")]
public int? Amount { get; set; }

/// <summary>
/// The amount to be deducted from each payment as an app fee, to be
/// paid to the partner integration which created the subscription, in
/// the lowest denomination for the currency (e.g. pence in GBP, cents
/// in EUR).
/// </summary>
[JsonProperty("app_fee")]
public int? AppFee { get; set; }

/// <summary>
/// The total number of payments that should be taken by this
/// subscription.
/// </summary>
[JsonProperty("count")]
public int? Count { get; set; }

/// <summary>
/// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes)
/// currency code. Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD",
/// "SEK" and "USD" are supported.
/// </summary>
[JsonProperty("currency")]
public string Currency { get; set; }

/// <summary>
/// As per RFC 2445. The day of the month to charge customers on.
/// `1`-`28` or `-1` to indicate the last day of the month.
/// </summary>
[JsonProperty("day_of_month")]
public int? DayOfMonth { get; set; }

/// <summary>
/// Number of `interval_units` between customer charge dates. Must be
/// greater than or equal to `1`. Must result in at least one charge
/// date per year. Defaults to `1`.
/// </summary>
[JsonProperty("interval")]
public int? Interval { get; set; }

/// <summary>
/// The unit of time between customer charge dates. One of `weekly`,
/// `monthly` or `yearly`.
/// </summary>
[JsonProperty("interval_unit")]
public BillingRequestSubscriptionRequestIntervalUnit? IntervalUnit { get; set; }

/// <summary>
/// Key-value store of custom data. Up to 3 keys are permitted, with key
/// names up to 50 characters and values up to 500 characters.
/// </summary>
[JsonProperty("metadata")]
public IDictionary<string, string> Metadata { get; set; }

/// <summary>
/// Name of the month on which to charge a customer. Must be lowercase.
/// Only applies
/// when the interval_unit is `yearly`.
///
/// </summary>
[JsonProperty("month")]
public BillingRequestSubscriptionRequestMonth? Month { get; set; }

/// <summary>
/// Optional name for the subscription. This will be set as the
/// description on each payment created. Must not exceed 255 characters.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }

/// <summary>
/// An optional payment reference. This will be set as the reference on
/// each payment
/// created and will appear on your customer's bank statement. See the
/// documentation for
/// the [create payment endpoint](#payments-create-a-payment) for more
/// details.
/// <br />
/// <p class="restricted-notice"><strong>Restricted</strong>: You need
/// your own Service User Number to specify a payment reference for Bacs
/// payments.</p>
/// </summary>
[JsonProperty("payment_reference")]
public string PaymentReference { get; set; }

/// <summary>
/// The date on which the first payment should be charged. Must be on or
/// after the [mandate](#core-endpoints-mandates)'s
/// `next_possible_charge_date`. When left blank and `month` or
/// `day_of_month` are provided, this will be set to the date of the
/// first payment. If created without `month` or `day_of_month` this
/// will be set as the mandate's `next_possible_charge_date`
/// </summary>
[JsonProperty("start_date")]
public string StartDate { get; set; }
}

/// <summary>
/// The unit of time between customer charge dates. One of `weekly`, `monthly` or `yearly`.
/// </summary>
[JsonConverter(typeof(GcStringEnumConverter), (int)Unknown)]
public enum BillingRequestSubscriptionRequestIntervalUnit {
/// <summary>Unknown status</summary>
[EnumMember(Value = "unknown")]
Unknown = 0,

/// <summary>`interval_unit` with a value of "weekly"</summary>
[EnumMember(Value = "weekly")]
Weekly,
/// <summary>`interval_unit` with a value of "monthly"</summary>
[EnumMember(Value = "monthly")]
Monthly,
/// <summary>`interval_unit` with a value of "yearly"</summary>
[EnumMember(Value = "yearly")]
Yearly,
}

/// <summary>
/// Name of the month on which to charge a customer. Must be lowercase. Only applies
/// when the interval_unit is `yearly`.
///
/// </summary>
[JsonConverter(typeof(GcStringEnumConverter), (int)Unknown)]
public enum BillingRequestSubscriptionRequestMonth {
/// <summary>Unknown status</summary>
[EnumMember(Value = "unknown")]
Unknown = 0,

/// <summary>`month` with a value of "january"</summary>
[EnumMember(Value = "january")]
January,
/// <summary>`month` with a value of "february"</summary>
[EnumMember(Value = "february")]
February,
/// <summary>`month` with a value of "march"</summary>
[EnumMember(Value = "march")]
March,
/// <summary>`month` with a value of "april"</summary>
[EnumMember(Value = "april")]
April,
/// <summary>`month` with a value of "may"</summary>
[EnumMember(Value = "may")]
May,
/// <summary>`month` with a value of "june"</summary>
[EnumMember(Value = "june")]
June,
/// <summary>`month` with a value of "july"</summary>
[EnumMember(Value = "july")]
July,
/// <summary>`month` with a value of "august"</summary>
[EnumMember(Value = "august")]
August,
/// <summary>`month` with a value of "september"</summary>
[EnumMember(Value = "september")]
September,
/// <summary>`month` with a value of "october"</summary>
[EnumMember(Value = "october")]
October,
/// <summary>`month` with a value of "november"</summary>
[EnumMember(Value = "november")]
November,
/// <summary>`month` with a value of "december"</summary>
[EnumMember(Value = "december")]
December,
}

}
14 changes: 7 additions & 7 deletions GoCardless/Resources/BillingRequestTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ namespace GoCardless.Resources
/// <summary>
/// Represents a billing request template resource.
///
/// Billing Request Templates are reusable templates that result in
/// numerous Billing Requests with similar attributes. They provide
/// 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.
/// 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,
/// 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:
/// 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
Expand Down Expand Up @@ -131,7 +131,7 @@ public class BillingRequestTemplate
public string Name { get; set; }

/// <summary>
/// Amount in minor unit (e.g. pence in GBP, cents in EUR).
/// Amount in full.
/// </summary>
[JsonProperty("payment_request_amount")]
public string PaymentRequestAmount { get; set; }
Expand Down
8 changes: 8 additions & 0 deletions GoCardless/Resources/CustomerBankAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public class CustomerBankAccount
[JsonProperty("account_type")]
public CustomerBankAccountAccountType? AccountType { get; set; }

/// <summary>
/// A token to uniquely refer to a set of bank account details. This
/// feature is still in early access and is only available for certain
/// organisations.
/// </summary>
[JsonProperty("bank_account_token")]
public string BankAccountToken { get; set; }

/// <summary>
/// Name of bank, taken from the bank details.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions GoCardless/Resources/Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,9 @@ public enum EventResourceType {
/// <summary>`resource_type` with a value of "organisations"</summary>
[EnumMember(Value = "organisations")]
Organisations,
/// <summary>`resource_type` with a value of "outbound_payments"</summary>
[EnumMember(Value = "outbound_payments")]
OutboundPayments,
/// <summary>`resource_type` with a value of "payer_authorisations"</summary>
[EnumMember(Value = "payer_authorisations")]
PayerAuthorisations,
Expand Down
35 changes: 35 additions & 0 deletions GoCardless/Resources/Mandate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public class Mandate
[JsonProperty("consent_parameters")]
public MandateConsentParameters ConsentParameters { get; set; }

/// <summary>
/// (Optional) Specifies the type of authorisation agreed between the
/// payer and merchant. It can be set to one-off, recurring or standing
/// for ACH, or single, recurring and sporadic for PAD.
/// </summary>
[JsonProperty("consent_type")]
public string ConsentType { get; set; }

/// <summary>
/// Fixed [timestamp](#api-usage-time-zones--dates), recording when this
/// resource was created.
Expand Down Expand Up @@ -272,6 +280,33 @@ public enum MandateConsentParameterPeriodPeriod {
Flexible,
}

/// <summary>
/// (Optional) Specifies the type of authorisation agreed between the payer and merchant. It can
/// be set to one-off, recurring or standing for ACH, or single, recurring and sporadic for PAD.
/// </summary>
[JsonConverter(typeof(GcStringEnumConverter), (int)Unknown)]
public enum MandateConsentType {
/// <summary>Unknown status</summary>
[EnumMember(Value = "unknown")]
Unknown = 0,

/// <summary>`consent_type` with a value of "one_off"</summary>
[EnumMember(Value = "one_off")]
OneOff,
/// <summary>`consent_type` with a value of "single"</summary>
[EnumMember(Value = "single")]
Single,
/// <summary>`consent_type` with a value of "recurring"</summary>
[EnumMember(Value = "recurring")]
Recurring,
/// <summary>`consent_type` with a value of "standing"</summary>
[EnumMember(Value = "standing")]
Standing,
/// <summary>`consent_type` with a value of "sporadic"</summary>
[EnumMember(Value = "sporadic")]
Sporadic,
}

/// <summary>
/// This field will decide how GoCardless handles settlement of funds from the customer.
///
Expand Down
Loading

0 comments on commit ebf2f8c

Please sign in to comment.