Class: Straddle::Resources::LinkedBankAccounts

Inherits:
Object
  • Object
show all
Defined in:
lib/straddle/resources/linked_bank_accounts.rb,
sig/straddle/resources/linked_bank_accounts.rbs

Overview

Linked bank accounts connect external bank accounts to an account or platform for charges, payouts, or billing.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ LinkedBankAccounts

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of LinkedBankAccounts.

Parameters:



242
243
244
# File 'lib/straddle/resources/linked_bank_accounts.rb', line 242

def initialize(client:)
  @client = client
end

Instance Method Details

#cancel(linked_bank_account_id, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::LinkedBankAccountResponse

Cancels a linked bank account and returns it with status canceled. The linked bank account must have status created.

Parameters:

  • linked_bank_account_id (String) —

    The ID of the linked bank account.

  • correlation_id (String) —

    Optional client-generated identifier for tracing a series of related requests.

  • idempotency_key (String) —

    Optional client-generated key for an idempotent request.

  • request_id (String) —

    Optional client-generated identifier for tracing one request.

  • request_options (Straddle::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/straddle/resources/linked_bank_accounts.rb', line 195

def cancel(, params = {})
  parsed, options = Straddle::LinkedBankAccountCancelParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["v1/linked_bank_accounts/%1$s/cancel", ],
    headers:
      parsed.transform_keys(
        correlation_id: "correlation-id",
        idempotency_key: "idempotency-key",
        request_id: "request-id"
      ),
    model: Straddle::LinkedBankAccountResponse,
    options: options
  )
end

#create(bank_account:, account_id: nil, description: nil, metadata: nil, platform_id: nil, purposes: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::LinkedBankAccountResponse

Some parameter documentations has been truncated, see Models::LinkedBankAccountCreateParams for more details.

Creates a linked bank account for an account or platform, assigns its payment purposes, and returns the linked bank account.

Parameters:

  • bank_account (Straddle::Models::LinkedBankAccountCreateParams::BankAccount) —

    Body param

  • account_id (String, nil) —

    Body param: ID of the account that will own the linked bank account. Omit this f

  • description (String, nil) —

    Body param: Your description for the linked bank account.

  • metadata (Hash{Symbol=>String, nil}, nil) —

    Body param: Up to 20 user-defined key-value pairs.

  • platform_id (String, nil) —

    Body param: ID of the platform to associate with the linked bank account.

  • purposes (Array<Symbol, Straddle::Models::LinkedBankAccountCreateParams::Purpose>, nil) —

    Body param: Payment purposes for the linked bank account. Defaults to charges,

  • correlation_id (String) —

    Header param: Optional client-generated identifier for tracing a series of relat

  • idempotency_key (String) —

    Header param: Optional client-generated key for an idempotent request.

  • request_id (String) —

    Header param: Optional client-generated identifier for tracing one request.

  • request_options (Straddle::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/straddle/resources/linked_bank_accounts.rb', line 39

def create(params)
  parsed, options = Straddle::LinkedBankAccountCreateParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id"
  }
  @client.request(
    method: :post,
    path: "v1/linked_bank_accounts",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::LinkedBankAccountResponse,
    options: options
  )
end

#list(account_id: nil, level: nil, page_number: nil, page_size: nil, purpose: nil, sort_by: nil, sort_order: nil, status: nil, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::LinkedBankAccountList

Some parameter documentations has been truncated, see Models::LinkedBankAccountListParams for more details.

Returns a paginated list of linked bank accounts. Filter the list by account, scope, purpose, or status.

Parameters:

Returns:

See Also:



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/straddle/resources/linked_bank_accounts.rb', line 159

def list(params = {})
  query_params = %i[account_id level page_number page_size purpose sort_by sort_order status]
  parsed, options = Straddle::LinkedBankAccountListParams.dump_request(params)
  query = Straddle::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "v1/linked_bank_accounts",
    query: query,
    headers:
      parsed.except(*query_params).transform_keys(
        correlation_id: "correlation-id",
        request_id: "request-id"
      ),
    model: Straddle::LinkedBankAccountList,
    options: options
  )
end

#list_unmasked(linked_bank_account_id, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::UnmaskedLinkedBankAccountResponse

Returns the linked bank account with the specified ID without masking its account number. This endpoint is available only when Straddle enables data unmasking for the account.

Parameters:

  • linked_bank_account_id (String) —

    The ID of the linked bank account.

  • correlation_id (String) —

    Optional client-generated identifier for tracing a series of related requests.

  • request_id (String) —

    Optional client-generated identifier for tracing one request.

  • request_options (Straddle::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



228
229
230
231
232
233
234
235
236
237
# File 'lib/straddle/resources/linked_bank_accounts.rb', line 228

def list_unmasked(, params = {})
  parsed, options = Straddle::LinkedBankAccountListUnmaskedParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/linked_bank_accounts/%1$s/unmask", ],
    headers: parsed.transform_keys(correlation_id: "correlation-id", request_id: "request-id"),
    model: Straddle::UnmaskedLinkedBankAccountResponse,
    options: options
  )
end

#retrieve(linked_bank_account_id, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::LinkedBankAccountResponse

Returns the linked bank account with the specified ID. The response masks the account number.

Parameters:

  • linked_bank_account_id (String) —

    The ID of the linked bank account.

  • correlation_id (String) —

    Optional client-generated identifier for tracing a series of related requests.

  • request_id (String) —

    Optional client-generated identifier for tracing one request.

  • request_options (Straddle::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



72
73
74
75
76
77
78
79
80
81
# File 'lib/straddle/resources/linked_bank_accounts.rb', line 72

def retrieve(, params = {})
  parsed, options = Straddle::LinkedBankAccountRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/linked_bank_accounts/%1$s", ],
    headers: parsed.transform_keys(correlation_id: "correlation-id", request_id: "request-id"),
    model: Straddle::LinkedBankAccountResponse,
    options: options
  )
end

#update(linked_bank_account_id, bank_account:, metadata: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::LinkedBankAccountResponse

Some parameter documentations has been truncated, see Models::LinkedBankAccountUpdateParams for more details.

Updates bank account details and metadata, then returns the linked bank account. The linked bank account must have status created, or status onboarding with status_detail.reason set to stuck.

Parameters:

  • linked_bank_account_id (String) —

    Path param: The ID of the linked bank account.

  • bank_account (Straddle::Models::LinkedBankAccountUpdateParams::BankAccount) —

    Body param

  • metadata (Hash{Symbol=>String, nil}, nil) —

    Body param: Up to 20 user-defined key-value pairs.

  • correlation_id (String) —

    Header param: Optional client-generated identifier for tracing a series of relat

  • idempotency_key (String) —

    Header param: Optional client-generated key for an idempotent request.

  • request_id (String) —

    Header param: Optional client-generated identifier for tracing one request.

  • request_options (Straddle::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/straddle/resources/linked_bank_accounts.rb', line 109

def update(, params)
  parsed, options = Straddle::LinkedBankAccountUpdateParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id"
  }
  @client.request(
    method: :put,
    path: ["v1/linked_bank_accounts/%1$s", ],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::LinkedBankAccountResponse,
    options: options
  )
end