Skip to content

Commit

Permalink
Changes generated by 5c56cd9fb5121b7ff5c73349a117630c79fd6692
Browse files Browse the repository at this point in the history
  • Loading branch information
gocardless-robot committed Jun 29, 2022
1 parent a79bb41 commit 35d33d9
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 9 deletions.
7 changes: 7 additions & 0 deletions src/services/billingRequestFlowService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ interface BillingRequestFlowCreateRequest {

lock_bank_account?: boolean;

// If true, the payer will not be able to change their currency/scheme manually
// within the flow. Note that this only applies to the mandate only flows -
// currency/scheme can never be changed when there is a specified subscription
// or payment.

lock_currency?: boolean;

// If true, the payer will not be able to edit their customer details within the
// flow. If the customer details are collected as part of bank_authorisation
// then GC will set this value to true mid flow
Expand Down
45 changes: 43 additions & 2 deletions src/services/billingRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ interface BillingRequestListRequest {
// <ul>
// <li>`pending`: the billing request is pending and can be used</li>
// <li>`ready_to_fulfil`: the billing request is ready to fulfil</li>
// <li>`fulfilling`: the billing request is currently undergoing fulfilment</li>
// <li>`fulfilled`: the billing request has been fulfilled and a payment
// created</li>
// <li>`cancelled`: the billing request has been cancelled and cannot be
Expand All @@ -48,8 +49,12 @@ interface BillingRequestListRequest {

interface BillingRequestCreateRequest {
// (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.
// direct debit.
// Should not be set if GoCardless payment intelligence feature is used.
//
// See [Billing Requests: Retain customers with
// Fallbacks](https://developer.gocardless.com/getting-started/billing-requests/retain-customers-with-fallbacks/)
// for more information.

fallback_enabled?: boolean;

Expand Down Expand Up @@ -144,6 +149,19 @@ interface BillingRequestFulfilRequest {
metadata?: Types.JsonMap;
}

interface BillingRequestChooseCurrencyRequest {
// [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?: string;

// 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.

metadata?: Types.JsonMap;
}

interface BillingRequestConfirmPayerDetailsRequest {
// 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.
Expand Down Expand Up @@ -327,6 +345,29 @@ export class BillingRequestService {
return formattedResponse;
}

async chooseCurrency(
identity: string,
requestParameters: BillingRequestChooseCurrencyRequest
): Promise<BillingRequestResponse> {
const urlParameters = [{ key: 'identity', value: identity }];
const requestParams = {
path: '/billing_requests/:identity/actions/choose_currency',
method: 'post',
urlParameters,
requestParameters,
payloadKey: null,
fetch: null,
};

const response = await this.api.request(requestParams);
const formattedResponse: BillingRequestResponse = {
...response.body['billing_requests'],
__response__: response.__response__,
};

return formattedResponse;
}

async confirmPayerDetails(
identity: string,
requestParameters: BillingRequestConfirmPayerDetailsRequest
Expand Down
51 changes: 44 additions & 7 deletions src/types/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ export interface BillingRequest {
created_at?: string;

// (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.
// 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/getting-started/billing-requests/retain-customers-with-fallbacks/)
// for more information.
fallback_enabled?: boolean;

// Unique identifier, beginning with "BRQ".
Expand All @@ -124,6 +128,8 @@ export interface BillingRequest {
// <ul>
// <li>`pending`: the billing request is pending and can be used</li>
// <li>`ready_to_fulfil`: the billing request is ready to fulfil</li>
// <li>`fulfilling`: the billing request is currently undergoing
// fulfilment</li>
// <li>`fulfilled`: the billing request has been fulfilled and a payment
// created</li>
// <li>`cancelled`: the billing request has been cancelled and cannot be
Expand Down Expand Up @@ -209,6 +215,11 @@ export interface BillingRequestCustomerBillingDetail {
// Danish krone (DKK).
danish_identity_number?: string | null;

// For ACH customers only. Required for ACH customers. A string containing the
// IP address of the payer to whom the mandate belongs (i.e. as a result of
// their completion of a mandate setup flow in their browser).
ip_address?: string | null;

// The customer's postal code.
postal_code?: string | null;

Expand All @@ -235,6 +246,9 @@ export enum BillingRequestNotificationType {

/** Type for a billingrequestaction resource. */
export interface BillingRequestAction {
// List of currencies the current mandate supports
available_currencies?: string[];

// Describes the behaviour of bank authorisations, for the bank_authorisation
// action
bank_authorisation?: BillingRequestActionBankAuthorisation;
Expand All @@ -259,6 +273,13 @@ export interface BillingRequestAction {
type?: BillingRequestActionType;
}

/** Type for a billingrequestactionavailablecurrencies resource. */
export interface BillingRequestActionAvailableCurrencies {
// [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency
// code.
currency?: string;
}

/** Type for a billingrequestactionbankauthorisation resource. */
export interface BillingRequestActionBankAuthorisation {
// Which authorisation adapter will be used to power these authorisations
Expand All @@ -278,6 +299,7 @@ export enum BillingRequestActionBankAuthorisationAdapter {
PlaidAis = 'plaid_ais',
OpenBankingGatewayAis = 'open_banking_gateway_ais',
BankidAis = 'bankid_ais',
BankPayRecurring = 'bank_pay_recurring',
}

export enum BillingRequestActionBankAuthorisationAuthorisationType {
Expand Down Expand Up @@ -334,6 +356,9 @@ export interface BillingRequestLinks {
// from this mandate request. this mandate request.
mandate_request_mandate?: string;

// ID of the associated organisation.
organisation?: string;

// (Optional) ID of the associated payment request
payment_request?: string;

Expand Down Expand Up @@ -619,6 +644,7 @@ export interface BillingRequestResourcesCustomerBillingDetail {
export enum BillingRequestStatus {
Pending = 'pending',
ReadyToFulfil = 'ready_to_fulfil',
Fulfilling = 'fulfilling',
Fulfilled = 'fulfilled',
Cancelled = 'cancelled',
}
Expand Down Expand Up @@ -654,6 +680,12 @@ export interface BillingRequestFlow {
// bank_authorisation then GC will set this value to true mid flow
lock_bank_account?: boolean;

// If true, the payer will not be able to change their currency/scheme
// manually within the flow. Note that this only applies to the mandate only
// flows - currency/scheme can never be changed when there is a specified
// subscription or payment.
lock_currency?: boolean;

// If true, the payer will not be able to edit their customer details within
// the flow. If the customer details are collected as part of
// bank_authorisation then GC will set this value to true mid flow
Expand Down Expand Up @@ -1121,6 +1153,7 @@ export enum CreditorSchemeIdentifierScheme {
Sepa = 'sepa',
SepaCreditTransfer = 'sepa_credit_transfer',
SepaInstantCreditTransfer = 'sepa_instant_credit_transfer',
PayTo = 'pay_to',
}

export enum CreditorVerificationStatus {
Expand Down Expand Up @@ -1865,6 +1898,11 @@ export enum InstalmentScheduleStatus {

/** Type for a institution resource. */
export interface Institution {
// Flag to show if the institution supports redirection to its authorisation
// flow or if a provider's one is being used. The bank authorisation screen on
// the UI is visible based on this property.
bank_redirect?: boolean;

// [ISO
// 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
// alpha-2 code. The country code of the institution.
Expand Down Expand Up @@ -3362,11 +3400,10 @@ export interface ScenarioSimulator {
// refund must start in `pending_submission`.</li>
// <li>`payout_bounced`: Transitions a payout to `bounced`. It must start in
// the `paid` state.</li>
// <li>`billing_request_fulfilled`: Authorises the billing request, fulfils
// it, and moves the associated payment to `failed`. The billing request must
// be in the `pending` state, with all actions completed except for
// `bank_authorisation`. Only billing requests with a `payment_request` are
// supported.</li>
// <li>`billing_request_fulfilled`: Authorises the billing request, and then
// fulfils it. The billing request must be in the `pending` state, with all
// actions completed except for `bank_authorisation`. Only billing requests
// with a `payment_request` are supported.</li>
// <li>`billing_request_fulfilled_and_payment_failed`: Authorises the billing
// request, fulfils it, and moves the associated payment to `failed`. The
// billing request must be in the `pending` state, with all actions completed
Expand Down

0 comments on commit 35d33d9

Please sign in to comment.