From 09d33f7c6d4419aff3cca3f7928a15e7254febbd Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:45:47 +0000 Subject: [PATCH] Changes generated by 2c1b52fbdda0f5cb04a6ca33564af2b2ff20525a This commit was automatically created from gocardless/gocardless-dotnet-template@2c1b52fbdda0f5cb04a6ca33564af2b2ff20525a by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-dotnet-template/actions/runs/12713595373 --- GoCardless/Resources/BillingRequest.cs | 44 +- GoCardless/Services/BillingRequestService.cs | 1138 ++++++++++++++++-- 2 files changed, 1017 insertions(+), 165 deletions(-) diff --git a/GoCardless/Resources/BillingRequest.cs b/GoCardless/Resources/BillingRequest.cs index ce20669..1c2fbf5 100644 --- a/GoCardless/Resources/BillingRequest.cs +++ b/GoCardless/Resources/BillingRequest.cs @@ -425,11 +425,10 @@ public class BillingRequestInstalmentScheduleRequest /// /// [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. + /// currency code. Currently "USD" and "CAD" are supported. /// [JsonProperty("currency")] - public BillingRequestInstalmentScheduleRequestCurrency? Currency { get; set; } + public string Currency { get; set; } /// /// instalments to be created. See [create (with @@ -497,42 +496,6 @@ public class BillingRequestInstalmentScheduleRequest public int? TotalAmount { get; set; } } - /// - /// [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. - /// - [JsonConverter(typeof(GcStringEnumConverter), (int)Unknown)] - public enum BillingRequestInstalmentScheduleRequestCurrency { - /// Unknown status - [EnumMember(Value = "unknown")] - Unknown = 0, - - /// `currency` with a value of "AUD" - [EnumMember(Value = "AUD")] - AUD, - /// `currency` with a value of "CAD" - [EnumMember(Value = "CAD")] - CAD, - /// `currency` with a value of "DKK" - [EnumMember(Value = "DKK")] - DKK, - /// `currency` with a value of "EUR" - [EnumMember(Value = "EUR")] - EUR, - /// `currency` with a value of "GBP" - [EnumMember(Value = "GBP")] - GBP, - /// `currency` with a value of "NZD" - [EnumMember(Value = "NZD")] - NZD, - /// `currency` with a value of "SEK" - [EnumMember(Value = "SEK")] - SEK, - /// `currency` with a value of "USD" - [EnumMember(Value = "USD")] - USD, - } - /// /// Resources linked to this BillingRequestInstalmentScheduleRequest /// @@ -1579,8 +1542,7 @@ public class BillingRequestSubscriptionRequest /// /// [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. + /// currency code. Currently "USD" and "CAD" are supported. /// [JsonProperty("currency")] public string Currency { get; set; } diff --git a/GoCardless/Services/BillingRequestService.cs b/GoCardless/Services/BillingRequestService.cs index 4a61f3e..7862c26 100644 --- a/GoCardless/Services/BillingRequestService.cs +++ b/GoCardless/Services/BillingRequestService.cs @@ -44,9 +44,8 @@ public BillingRequestService(GoCardlessClient goCardlessClient) /// ///

Important: All properties - /// associated with `subscription_request` and - /// `instalment_schedule_request` are only supported for ACH and PAD - /// schemes.

+ /// associated with `subscription_request` are only supported for ACH + /// and PAD schemes.

///
/// An optional `BillingRequestCreateRequest` representing the body for this create request. /// An optional `RequestSettings` allowing you to configure the request @@ -61,6 +60,42 @@ public Task CreateAsync(BillingRequestCreateRequest requ return _goCardlessClient.ExecuteAsync("POST", "/billing_requests", urlParams, request, id => GetAsync(id, null, customiseRequestMessage), "billing_requests", customiseRequestMessage); } + /// + ///

Important: All properties + /// associated with `instalment_schedule_request` are only supported for + /// ACH and PAD schemes.

+ ///
+ /// An optional `BillingRequestCreateWithInstalmentsWithDatesRequest` representing the body for this create_with_instalments_with_dates request. + /// An optional `RequestSettings` allowing you to configure the request + /// A single billing request resource + public Task CreateWithInstalmentsWithDatesAsync(BillingRequestCreateWithInstalmentsWithDatesRequest request = null, RequestSettings customiseRequestMessage = null) + { + request = request ?? new BillingRequestCreateWithInstalmentsWithDatesRequest(); + + var urlParams = new List> + {}; + + return _goCardlessClient.ExecuteAsync("POST", "/billing_requests", urlParams, request, id => GetAsync(id, null, customiseRequestMessage), "billing_requests", customiseRequestMessage); + } + + /// + ///

Important: All properties + /// associated with `instalment_schedule_request` are only supported for + /// ACH and PAD schemes.

+ ///
+ /// An optional `BillingRequestCreateWithInstalmentsWithScheduleRequest` representing the body for this create_with_instalments_with_schedule request. + /// An optional `RequestSettings` allowing you to configure the request + /// A single billing request resource + public Task CreateWithInstalmentsWithScheduleAsync(BillingRequestCreateWithInstalmentsWithScheduleRequest request = null, RequestSettings customiseRequestMessage = null) + { + request = request ?? new BillingRequestCreateWithInstalmentsWithScheduleRequest(); + + var urlParams = new List> + {}; + + return _goCardlessClient.ExecuteAsync("POST", "/billing_requests", urlParams, request, id => GetAsync(id, null, customiseRequestMessage), "billing_requests", customiseRequestMessage); + } + /// /// If the billing request has a pending /// collect_customer_details @@ -380,8 +415,8 @@ public Task SelectInstitutionAsync(string identity, Bill /// ///

Important: All properties associated - /// with `subscription_request` and `instalment_schedule_request` are only - /// supported for ACH and PAD schemes.

+ /// with `subscription_request` are only supported for ACH and PAD + /// schemes.

///
public class BillingRequestCreateRequest : IHasIdempotencyKey { @@ -399,125 +434,6 @@ public class BillingRequestCreateRequest : IHasIdempotencyKey [JsonProperty("fallback_enabled")] public bool? FallbackEnabled { get; set; } - [JsonProperty("instalment_schedule_request")] - public BillingRequestInstalmentScheduleRequest InstalmentScheduleRequest { get; set; } - /// - /// - /// - public class BillingRequestInstalmentScheduleRequest - { - - /// - /// 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). - /// - [JsonProperty("app_fee")] - public int? AppFee { get; set; } - - /// - /// [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. - /// - [JsonProperty("currency")] - public BillingRequestCurrency? Currency { get; set; } - /// - /// [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. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum BillingRequestCurrency - { - - /// `currency` with a value of "AUD" - [EnumMember(Value = "AUD")] - AUD, - /// `currency` with a value of "CAD" - [EnumMember(Value = "CAD")] - CAD, - /// `currency` with a value of "DKK" - [EnumMember(Value = "DKK")] - DKK, - /// `currency` with a value of "EUR" - [EnumMember(Value = "EUR")] - EUR, - /// `currency` with a value of "GBP" - [EnumMember(Value = "GBP")] - GBP, - /// `currency` with a value of "NZD" - [EnumMember(Value = "NZD")] - NZD, - /// `currency` with a value of "SEK" - [EnumMember(Value = "SEK")] - SEK, - /// `currency` with a value of "USD" - [EnumMember(Value = "USD")] - USD, - } - - /// - /// instalments to be created. See [create (with - /// dates)](#instalment-schedules-create-with-dates) and [create - /// (with schedule)](#instalment-schedules-create-with-schedule) for - /// more information on how to specify instalments. - /// - [JsonProperty("instalments")] - public IDictionary Instalments { get; set; } - - /// - /// 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. - /// - [JsonProperty("metadata")] - public IDictionary Metadata { get; set; } - - /// - /// Name of the instalment schedule, up to 100 chars. This name will - /// also be - /// copied to the payments of the instalment schedule if you use - /// schedule-based creation. - /// - [JsonProperty("name")] - public string Name { get; set; } - - /// - /// 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. - ///
- ///
- [JsonProperty("payment_reference")] - public string PaymentReference { get; set; } - - /// - /// On failure, automatically retry payments using [intelligent - /// retries](#success-intelligent-retries). Default is `false`.

Important: To be able to use - /// intelligent retries, Success+ needs to be enabled in [GoCardless - /// dashboard](https://manage.gocardless.com/success-plus).

- ///
- [JsonProperty("retry_if_possible")] - public bool? RetryIfPossible { get; set; } - - /// - /// The total amount of the instalment schedule, defined as the sum - /// of all individual - /// payments, in the lowest denomination for the currency (e.g. - /// pence in GBP, cents in - /// EUR). If the requested payment amounts do not sum up correctly, - /// a validation error - /// will be returned. - /// - [JsonProperty("total_amount")] - public int? TotalAmount { get; set; } - } - /// /// Linked resources. /// @@ -1257,6 +1173,980 @@ public enum BillingRequestMonth } + /// + ///

Important: All properties associated + /// with `instalment_schedule_request` are only supported for ACH and PAD + /// schemes.

+ ///
+ public class BillingRequestCreateWithInstalmentsWithDatesRequest : IHasIdempotencyKey + { + + /// + /// (Optional) If true, this billing request can fallback from instant + /// payment to direct debit. + /// Should not be set if GoCardless payment intelligence feature is + /// used. + /// + /// See [Billing Requests: Retain customers with + /// Fallbacks](https://developer.gocardless.com/billing-requests/retain-customers-with-fallbacks/) + /// for more information. + /// + [JsonProperty("fallback_enabled")] + public bool? FallbackEnabled { get; set; } + + [JsonProperty("instalment_schedule_request")] + public BillingRequestInstalmentScheduleRequest InstalmentScheduleRequest { get; set; } + /// + /// + /// + public class BillingRequestInstalmentScheduleRequest + { + + /// + /// 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). + /// + [JsonProperty("app_fee")] + public int? AppFee { get; set; } + + /// + /// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) + /// currency code. Currently "USD" and "CAD" are supported. + /// + [JsonProperty("currency")] + public string Currency { get; set; } + + /// + /// An explicit array of instalment payments, each specifying at + /// least an `amount` and `charge_date`. See [create (with + /// dates)](#instalment-schedules-create-with-dates) + /// + [JsonProperty("instalments")] + public BillingRequestInstalments[] Instalments { get; set; } + /// + /// + /// + public class BillingRequestInstalments + { + + /// + /// Amount, in the lowest denomination for the currency (e.g. pence + /// in GBP, cents in EUR). + /// + [JsonProperty("amount")] + public int? Amount { get; set; } + + /// + /// A future date on which the payment should be collected. If the + /// date + /// is before the next_possible_charge_date on the + /// [mandate](#core-endpoints-mandates), it will be automatically + /// rolled + /// forwards to that date. + /// + [JsonProperty("charge_date")] + public string ChargeDate { get; set; } + + /// + /// A human-readable description of the payment. This will be + /// included in the notification email GoCardless sends to your + /// customer if your organisation does not send its own + /// notifications (see [compliance + /// requirements](#appendix-compliance-requirements)). + /// + [JsonProperty("description")] + public string Description { get; set; } + } + + /// + /// 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. + /// + [JsonProperty("metadata")] + public IDictionary Metadata { get; set; } + + /// + /// Name of the instalment schedule, up to 100 chars. This name will + /// also be + /// copied to the payments of the instalment schedule if you use + /// schedule-based creation. + /// + [JsonProperty("name")] + public string Name { get; set; } + + /// + /// 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. + ///
+ ///
+ [JsonProperty("payment_reference")] + public string PaymentReference { get; set; } + + /// + /// On failure, automatically retry payments using [intelligent + /// retries](#success-intelligent-retries). Default is `false`.

Important: To be able to use + /// intelligent retries, Success+ needs to be enabled in [GoCardless + /// dashboard](https://manage.gocardless.com/success-plus).

+ ///
+ [JsonProperty("retry_if_possible")] + public bool? RetryIfPossible { get; set; } + + /// + /// The total amount of the instalment schedule, defined as the sum + /// of all individual + /// payments, in the lowest denomination for the currency (e.g. + /// pence in GBP, cents in + /// EUR). If the requested payment amounts do not sum up correctly, + /// a validation error + /// will be returned. + /// + [JsonProperty("total_amount")] + public int? TotalAmount { get; set; } + } + + /// + /// Linked resources. + /// + [JsonProperty("links")] + public BillingRequestLinks Links { get; set; } + /// + /// Linked resources for a BillingRequest. + /// + public class BillingRequestLinks + { + + /// + /// ID of the associated [creditor](#core-endpoints-creditors). Only + /// required if your account manages multiple creditors. + /// + [JsonProperty("creditor")] + public string Creditor { get; set; } + + /// + /// ID of the [customer](#core-endpoints-customers) against which + /// this request should be made. + /// + [JsonProperty("customer")] + public string Customer { get; set; } + + /// + /// (Optional) ID of the + /// [customer_bank_account](#core-endpoints-customer-bank-accounts) + /// against which this request should be made. + /// + /// + [JsonProperty("customer_bank_account")] + public string CustomerBankAccount { get; set; } + } + + [JsonProperty("mandate_request")] + public BillingRequestMandateRequest MandateRequest { get; set; } + /// + /// + /// + public class BillingRequestMandateRequest + { + + /// + /// This field is ACH specific, sometimes referred to as [SEC + /// code](https://www.moderntreasury.com/learn/sec-codes). + /// + /// This is the way that the payer gives authorisation to the + /// merchant. + /// web: Authorisation is Internet Initiated or via Mobile Entry + /// (maps to SEC code: WEB) + /// telephone: Authorisation is provided orally over telephone + /// (maps to SEC code: TEL) + /// paper: Authorisation is provided in writing and signed, or + /// similarly authenticated (maps to SEC code: PPD) + /// + /// + [JsonProperty("authorisation_source")] + public BillingRequestAuthorisationSource? AuthorisationSource { get; set; } + /// + /// This field is ACH specific, sometimes referred to as [SEC + /// code](https://www.moderntreasury.com/learn/sec-codes). + /// + /// This is the way that the payer gives authorisation to the merchant. + /// web: Authorisation is Internet Initiated or via Mobile Entry (maps + /// to SEC code: WEB) + /// telephone: Authorisation is provided orally over telephone (maps + /// to SEC code: TEL) + /// paper: Authorisation is provided in writing and signed, or + /// similarly authenticated (maps to SEC code: PPD) + /// + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum BillingRequestAuthorisationSource + { + + /// `authorisation_source` with a value of "web" + [EnumMember(Value = "web")] + Web, + /// `authorisation_source` with a value of "telephone" + [EnumMember(Value = "telephone")] + Telephone, + /// `authorisation_source` with a value of "paper" + [EnumMember(Value = "paper")] + Paper, + } + + /// + /// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) + /// currency code. Currently "USD" and "CAD" are supported. + /// + [JsonProperty("currency")] + public string Currency { get; set; } + + /// + /// A human-readable description of the payment and/or mandate. This + /// will be displayed to the payer when authorising the billing + /// request. + /// + /// + [JsonProperty("description")] + public string Description { get; set; } + + /// + /// 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. + /// + [JsonProperty("metadata")] + public IDictionary Metadata { get; set; } + + /// + /// Unique reference. Different schemes have different length and + /// [character set](#appendix-character-sets) requirements. + /// GoCardless will generate a unique reference satisfying the + /// different scheme requirements if this field is left blank. + /// + [JsonProperty("reference")] + public string Reference { get; set; } + + /// + /// Payment scheme. Currently supports `ach` in the US (USD) and + /// 'pad' in the Canada (CAD) + /// + [JsonProperty("scheme")] + public string Scheme { get; set; } + + /// + /// Verification preference for the mandate. One of: + ///
    + ///
  • `minimum`: only verify if absolutely required, such as + /// when part of scheme rules
  • + ///
  • `recommended`: in addition to `minimum`, use the + /// GoCardless payment intelligence solution to decide if a payer + /// should be verified
  • + ///
  • `when_available`: if verification mechanisms are + /// available, use them
  • + ///
  • `always`: as `when_available`, but fail to create the + /// Billing Request if a mechanism isn't available
  • + ///
+ /// + /// By default, all Billing Requests use the `recommended` + /// verification preference. It uses GoCardless payment intelligence + /// solution to determine if a payer is fraudulent or not. The + /// verification mechanism is based on the response and the payer + /// may be asked to verify themselves. If the feature is not + /// available, `recommended` behaves like `minimum`. + /// + /// If you never wish to take advantage of our reduced risk products + /// and Verified Mandates as they are released in new schemes, + /// please use the `minimum` verification preference. + /// + /// See [Billing Requests: Creating Verified + /// Mandates](https://developer.gocardless.com/getting-started/billing-requests/verified-mandates/) + /// for more information. + ///
+ [JsonProperty("verify")] + public BillingRequestVerify? Verify { get; set; } + /// + /// Verification preference for the mandate. One of: + ///
    + ///
  • `minimum`: only verify if absolutely required, such as when + /// part of scheme rules
  • + ///
  • `recommended`: in addition to `minimum`, use the GoCardless + /// payment intelligence solution to decide if a payer should be + /// verified
  • + ///
  • `when_available`: if verification mechanisms are available, + /// use them
  • + ///
  • `always`: as `when_available`, but fail to create the Billing + /// Request if a mechanism isn't available
  • + ///
+ /// + /// By default, all Billing Requests use the `recommended` verification + /// preference. It uses GoCardless payment intelligence solution to + /// determine if a payer is fraudulent or not. The verification + /// mechanism is based on the response and the payer may be asked to + /// verify themselves. If the feature is not available, `recommended` + /// behaves like `minimum`. + /// + /// If you never wish to take advantage of our reduced risk products and + /// Verified Mandates as they are released in new schemes, please use + /// the `minimum` verification preference. + /// + /// See [Billing Requests: Creating Verified + /// Mandates](https://developer.gocardless.com/getting-started/billing-requests/verified-mandates/) + /// for more information. + ///
+ [JsonConverter(typeof(StringEnumConverter))] + public enum BillingRequestVerify + { + + /// `verify` with a value of "minimum" + [EnumMember(Value = "minimum")] + Minimum, + /// `verify` with a value of "recommended" + [EnumMember(Value = "recommended")] + Recommended, + /// `verify` with a value of "when_available" + [EnumMember(Value = "when_available")] + WhenAvailable, + /// `verify` with a value of "always" + [EnumMember(Value = "always")] + Always, + } + } + + /// + /// 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. + /// + [JsonProperty("metadata")] + public IDictionary Metadata { get; set; } + + [JsonProperty("payment_request")] + public BillingRequestPaymentRequest PaymentRequest { get; set; } + /// + /// + /// + public class BillingRequestPaymentRequest + { + + /// + /// Amount in minor unit (e.g. pence in GBP, cents in EUR). + /// + [JsonProperty("amount")] + public int? Amount { get; set; } + + /// + /// The amount to be deducted from the payment as an app fee, to be + /// paid to the partner integration which created the billing + /// request, in the lowest denomination for the currency (e.g. pence + /// in GBP, cents in EUR). + /// + [JsonProperty("app_fee")] + public int? AppFee { get; set; } + + /// + /// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) + /// currency code. Currently "USD" and "CAD" are supported. + /// + [JsonProperty("currency")] + public string Currency { get; set; } + + /// + /// A human-readable description of the payment and/or mandate. This + /// will be displayed to the payer when authorising the billing + /// request. + /// + /// + [JsonProperty("description")] + public string Description { get; set; } + + /// + /// This field will decide how GoCardless handles settlement of + /// funds from the customer. + /// + /// - `managed` will be moved through GoCardless' account, batched, + /// and payed out. + /// - `direct` will be a direct transfer from the payer's account to + /// the merchant where + /// invoicing will be handled separately. + /// + /// + [JsonProperty("funds_settlement")] + public BillingRequestFundsSettlement? FundsSettlement { get; set; } + /// + /// This field will decide how GoCardless handles settlement of funds + /// from the customer. + /// + /// - `managed` will be moved through GoCardless' account, batched, and + /// payed out. + /// - `direct` will be a direct transfer from the payer's account to the + /// merchant where + /// invoicing will be handled separately. + /// + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum BillingRequestFundsSettlement + { + + /// `funds_settlement` with a value of "managed" + [EnumMember(Value = "managed")] + Managed, + /// `funds_settlement` with a value of "direct" + [EnumMember(Value = "direct")] + Direct, + } + + /// + /// 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. + /// + [JsonProperty("metadata")] + public IDictionary Metadata { get; set; } + + /// + /// A custom payment reference defined by the merchant. It is only + /// available for payments using the Direct Funds settlement model + /// on the Faster Payments scheme. + /// + /// + [JsonProperty("reference")] + public string Reference { get; set; } + + /// + /// On failure, automatically retry payments using [intelligent + /// retries](#success-intelligent-retries). Default is `false`.

Important: To be able to use + /// intelligent retries, Success+ needs to be enabled in [GoCardless + /// dashboard](https://manage.gocardless.com/success-plus).

+ ///
+ [JsonProperty("retry_if_possible")] + public bool? RetryIfPossible { get; set; } + + /// + /// Payment scheme. Currently supports `ach` in the US (USD) and + /// 'pad' in the Canada (CAD) + /// + [JsonProperty("scheme")] + public string Scheme { get; set; } + } + + /// + /// A unique key to ensure that this request only succeeds once, allowing you to safely retry request errors such as network failures. + /// Any requests, where supported, to create a resource with a key that has previously been used will not succeed. + /// See: https://developer.gocardless.com/api-reference/#making-requests-idempotency-keys + /// + [JsonIgnore] + public string IdempotencyKey { get; set; } + } + + + /// + ///

Important: All properties associated + /// with `instalment_schedule_request` are only supported for ACH and PAD + /// schemes.

+ ///
+ public class BillingRequestCreateWithInstalmentsWithScheduleRequest : IHasIdempotencyKey + { + + /// + /// (Optional) If true, this billing request can fallback from instant + /// payment to direct debit. + /// Should not be set if GoCardless payment intelligence feature is + /// used. + /// + /// See [Billing Requests: Retain customers with + /// Fallbacks](https://developer.gocardless.com/billing-requests/retain-customers-with-fallbacks/) + /// for more information. + /// + [JsonProperty("fallback_enabled")] + public bool? FallbackEnabled { get; set; } + + [JsonProperty("instalment_schedule_request")] + public BillingRequestInstalmentScheduleRequest InstalmentScheduleRequest { get; set; } + /// + /// + /// + public class BillingRequestInstalmentScheduleRequest + { + + /// + /// 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). + /// + [JsonProperty("app_fee")] + public int? AppFee { get; set; } + + /// + /// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) + /// currency code. Currently "USD" and "CAD" are supported. + /// + [JsonProperty("currency")] + public string Currency { get; set; } + + /// + /// Frequency of the payments you want to create, together with an + /// array of payment + /// amounts to be collected, with a specified start date for the + /// first payment. + /// See [create (with + /// schedule)](#instalment-schedules-create-with-schedule) + /// + /// + [JsonProperty("instalments")] + public BillingRequestInstalments Instalments { get; set; } + /// + /// Frequency of the payments you want to create, together with an array + /// of payment + /// amounts to be collected, with a specified start date for the first + /// payment. + /// See [create (with + /// schedule)](#instalment-schedules-create-with-schedule) + /// + /// + public class BillingRequestInstalments + { + + /// + /// List of amounts of each instalment, in the lowest denomination + /// for the + /// currency (e.g. cents in USD). + /// + /// + [JsonProperty("amounts")] + public int?[] Amounts { get; set; } + + /// + /// Number of `interval_units` between charge dates. Must be greater + /// than or + /// equal to `1`. + /// + /// + [JsonProperty("interval")] + public int? Interval { get; set; } + + /// + /// The unit of time between customer charge dates. One of `weekly`, + /// `monthly` or `yearly`. + /// + [JsonProperty("interval_unit")] + public BillingRequestIntervalUnit? IntervalUnit { get; set; } + /// + /// The unit of time between customer charge dates. One of `weekly`, + /// `monthly` or `yearly`. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum BillingRequestIntervalUnit + { + + /// `interval_unit` with a value of "weekly" + [EnumMember(Value = "weekly")] + Weekly, + /// `interval_unit` with a value of "monthly" + [EnumMember(Value = "monthly")] + Monthly, + /// `interval_unit` with a value of "yearly" + [EnumMember(Value = "yearly")] + Yearly, + } + + /// + /// 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` + /// + [JsonProperty("start_date")] + public string StartDate { get; set; } + } + + /// + /// 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. + /// + [JsonProperty("metadata")] + public IDictionary Metadata { get; set; } + + /// + /// Name of the instalment schedule, up to 100 chars. This name will + /// also be + /// copied to the payments of the instalment schedule if you use + /// schedule-based creation. + /// + [JsonProperty("name")] + public string Name { get; set; } + + /// + /// 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. + ///
+ ///
+ [JsonProperty("payment_reference")] + public string PaymentReference { get; set; } + + /// + /// On failure, automatically retry payments using [intelligent + /// retries](#success-intelligent-retries). Default is `false`.

Important: To be able to use + /// intelligent retries, Success+ needs to be enabled in [GoCardless + /// dashboard](https://manage.gocardless.com/success-plus).

+ ///
+ [JsonProperty("retry_if_possible")] + public bool? RetryIfPossible { get; set; } + + /// + /// The total amount of the instalment schedule, defined as the sum + /// of all individual + /// payments, in the lowest denomination for the currency (e.g. + /// pence in GBP, cents in + /// EUR). If the requested payment amounts do not sum up correctly, + /// a validation error + /// will be returned. + /// + [JsonProperty("total_amount")] + public int? TotalAmount { get; set; } + } + + /// + /// Linked resources. + /// + [JsonProperty("links")] + public BillingRequestLinks Links { get; set; } + /// + /// Linked resources for a BillingRequest. + /// + public class BillingRequestLinks + { + + /// + /// ID of the associated [creditor](#core-endpoints-creditors). Only + /// required if your account manages multiple creditors. + /// + [JsonProperty("creditor")] + public string Creditor { get; set; } + + /// + /// ID of the [customer](#core-endpoints-customers) against which + /// this request should be made. + /// + [JsonProperty("customer")] + public string Customer { get; set; } + + /// + /// (Optional) ID of the + /// [customer_bank_account](#core-endpoints-customer-bank-accounts) + /// against which this request should be made. + /// + /// + [JsonProperty("customer_bank_account")] + public string CustomerBankAccount { get; set; } + } + + [JsonProperty("mandate_request")] + public BillingRequestMandateRequest MandateRequest { get; set; } + /// + /// + /// + public class BillingRequestMandateRequest + { + + /// + /// This field is ACH specific, sometimes referred to as [SEC + /// code](https://www.moderntreasury.com/learn/sec-codes). + /// + /// This is the way that the payer gives authorisation to the + /// merchant. + /// web: Authorisation is Internet Initiated or via Mobile Entry + /// (maps to SEC code: WEB) + /// telephone: Authorisation is provided orally over telephone + /// (maps to SEC code: TEL) + /// paper: Authorisation is provided in writing and signed, or + /// similarly authenticated (maps to SEC code: PPD) + /// + /// + [JsonProperty("authorisation_source")] + public BillingRequestAuthorisationSource? AuthorisationSource { get; set; } + /// + /// This field is ACH specific, sometimes referred to as [SEC + /// code](https://www.moderntreasury.com/learn/sec-codes). + /// + /// This is the way that the payer gives authorisation to the merchant. + /// web: Authorisation is Internet Initiated or via Mobile Entry (maps + /// to SEC code: WEB) + /// telephone: Authorisation is provided orally over telephone (maps + /// to SEC code: TEL) + /// paper: Authorisation is provided in writing and signed, or + /// similarly authenticated (maps to SEC code: PPD) + /// + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum BillingRequestAuthorisationSource + { + + /// `authorisation_source` with a value of "web" + [EnumMember(Value = "web")] + Web, + /// `authorisation_source` with a value of "telephone" + [EnumMember(Value = "telephone")] + Telephone, + /// `authorisation_source` with a value of "paper" + [EnumMember(Value = "paper")] + Paper, + } + + /// + /// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) + /// currency code. Currently "USD" and "CAD" are supported. + /// + [JsonProperty("currency")] + public string Currency { get; set; } + + /// + /// A human-readable description of the payment and/or mandate. This + /// will be displayed to the payer when authorising the billing + /// request. + /// + /// + [JsonProperty("description")] + public string Description { get; set; } + + /// + /// 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. + /// + [JsonProperty("metadata")] + public IDictionary Metadata { get; set; } + + /// + /// Unique reference. Different schemes have different length and + /// [character set](#appendix-character-sets) requirements. + /// GoCardless will generate a unique reference satisfying the + /// different scheme requirements if this field is left blank. + /// + [JsonProperty("reference")] + public string Reference { get; set; } + + /// + /// Payment scheme. Currently supports `ach` in the US (USD) and + /// 'pad' in the Canada (CAD) + /// + [JsonProperty("scheme")] + public string Scheme { get; set; } + + /// + /// Verification preference for the mandate. One of: + ///
    + ///
  • `minimum`: only verify if absolutely required, such as + /// when part of scheme rules
  • + ///
  • `recommended`: in addition to `minimum`, use the + /// GoCardless payment intelligence solution to decide if a payer + /// should be verified
  • + ///
  • `when_available`: if verification mechanisms are + /// available, use them
  • + ///
  • `always`: as `when_available`, but fail to create the + /// Billing Request if a mechanism isn't available
  • + ///
+ /// + /// By default, all Billing Requests use the `recommended` + /// verification preference. It uses GoCardless payment intelligence + /// solution to determine if a payer is fraudulent or not. The + /// verification mechanism is based on the response and the payer + /// may be asked to verify themselves. If the feature is not + /// available, `recommended` behaves like `minimum`. + /// + /// If you never wish to take advantage of our reduced risk products + /// and Verified Mandates as they are released in new schemes, + /// please use the `minimum` verification preference. + /// + /// See [Billing Requests: Creating Verified + /// Mandates](https://developer.gocardless.com/getting-started/billing-requests/verified-mandates/) + /// for more information. + ///
+ [JsonProperty("verify")] + public BillingRequestVerify? Verify { get; set; } + /// + /// Verification preference for the mandate. One of: + ///
    + ///
  • `minimum`: only verify if absolutely required, such as when + /// part of scheme rules
  • + ///
  • `recommended`: in addition to `minimum`, use the GoCardless + /// payment intelligence solution to decide if a payer should be + /// verified
  • + ///
  • `when_available`: if verification mechanisms are available, + /// use them
  • + ///
  • `always`: as `when_available`, but fail to create the Billing + /// Request if a mechanism isn't available
  • + ///
+ /// + /// By default, all Billing Requests use the `recommended` verification + /// preference. It uses GoCardless payment intelligence solution to + /// determine if a payer is fraudulent or not. The verification + /// mechanism is based on the response and the payer may be asked to + /// verify themselves. If the feature is not available, `recommended` + /// behaves like `minimum`. + /// + /// If you never wish to take advantage of our reduced risk products and + /// Verified Mandates as they are released in new schemes, please use + /// the `minimum` verification preference. + /// + /// See [Billing Requests: Creating Verified + /// Mandates](https://developer.gocardless.com/getting-started/billing-requests/verified-mandates/) + /// for more information. + ///
+ [JsonConverter(typeof(StringEnumConverter))] + public enum BillingRequestVerify + { + + /// `verify` with a value of "minimum" + [EnumMember(Value = "minimum")] + Minimum, + /// `verify` with a value of "recommended" + [EnumMember(Value = "recommended")] + Recommended, + /// `verify` with a value of "when_available" + [EnumMember(Value = "when_available")] + WhenAvailable, + /// `verify` with a value of "always" + [EnumMember(Value = "always")] + Always, + } + } + + /// + /// 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. + /// + [JsonProperty("metadata")] + public IDictionary Metadata { get; set; } + + [JsonProperty("payment_request")] + public BillingRequestPaymentRequest PaymentRequest { get; set; } + /// + /// + /// + public class BillingRequestPaymentRequest + { + + /// + /// Amount in minor unit (e.g. pence in GBP, cents in EUR). + /// + [JsonProperty("amount")] + public int? Amount { get; set; } + + /// + /// The amount to be deducted from the payment as an app fee, to be + /// paid to the partner integration which created the billing + /// request, in the lowest denomination for the currency (e.g. pence + /// in GBP, cents in EUR). + /// + [JsonProperty("app_fee")] + public int? AppFee { get; set; } + + /// + /// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) + /// currency code. Currently "USD" and "CAD" are supported. + /// + [JsonProperty("currency")] + public string Currency { get; set; } + + /// + /// A human-readable description of the payment and/or mandate. This + /// will be displayed to the payer when authorising the billing + /// request. + /// + /// + [JsonProperty("description")] + public string Description { get; set; } + + /// + /// This field will decide how GoCardless handles settlement of + /// funds from the customer. + /// + /// - `managed` will be moved through GoCardless' account, batched, + /// and payed out. + /// - `direct` will be a direct transfer from the payer's account to + /// the merchant where + /// invoicing will be handled separately. + /// + /// + [JsonProperty("funds_settlement")] + public BillingRequestFundsSettlement? FundsSettlement { get; set; } + /// + /// This field will decide how GoCardless handles settlement of funds + /// from the customer. + /// + /// - `managed` will be moved through GoCardless' account, batched, and + /// payed out. + /// - `direct` will be a direct transfer from the payer's account to the + /// merchant where + /// invoicing will be handled separately. + /// + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum BillingRequestFundsSettlement + { + + /// `funds_settlement` with a value of "managed" + [EnumMember(Value = "managed")] + Managed, + /// `funds_settlement` with a value of "direct" + [EnumMember(Value = "direct")] + Direct, + } + + /// + /// 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. + /// + [JsonProperty("metadata")] + public IDictionary Metadata { get; set; } + + /// + /// A custom payment reference defined by the merchant. It is only + /// available for payments using the Direct Funds settlement model + /// on the Faster Payments scheme. + /// + /// + [JsonProperty("reference")] + public string Reference { get; set; } + + /// + /// On failure, automatically retry payments using [intelligent + /// retries](#success-intelligent-retries). Default is `false`.

Important: To be able to use + /// intelligent retries, Success+ needs to be enabled in [GoCardless + /// dashboard](https://manage.gocardless.com/success-plus).

+ ///
+ [JsonProperty("retry_if_possible")] + public bool? RetryIfPossible { get; set; } + + /// + /// Payment scheme. Currently supports `ach` in the US (USD) and + /// 'pad' in the Canada (CAD) + /// + [JsonProperty("scheme")] + public string Scheme { get; set; } + } + + /// + /// A unique key to ensure that this request only succeeds once, allowing you to safely retry request errors such as network failures. + /// Any requests, where supported, to create a resource with a key that has previously been used will not succeed. + /// See: https://developer.gocardless.com/api-reference/#making-requests-idempotency-keys + /// + [JsonIgnore] + public string IdempotencyKey { get; set; } + } + + /// /// If the billing request has a pending /// collect_customer_details