Class: Straddle::Resources::FundingEvents

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

Overview

Funding events group charge and payout activity into transfers between Straddle and your linked bank account.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ FundingEvents

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

Parameters:



232
233
234
# File 'lib/straddle/resources/funding_events.rb', line 232

def initialize(client:)
  @client = client
end

Instance Method Details

#list(created_from: nil, created_to: nil, direction: nil, event_type: nil, page_number: nil, page_size: nil, search_text: nil, sort_by: nil, sort_order: nil, status: nil, status_reason: nil, status_source: nil, trace_id: nil, trace_number: nil, correlation_id: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::FundingEventSummaryList

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

Returns a paginated list of funding events that match the specified filters.

Parameters:

  • created_from (Date, nil) —

    Query param: Filter to funding events created on or after this date.

  • created_to (Date, nil) —

    Query param: Filter to funding events created on or before this date.

  • direction (Symbol, Straddle::Models::TransferDirection) —

    Query param: Filter by transfer direction relative to the linked bank account.

  • event_type (Symbol, Straddle::Models::FundingEventType) —

    Query param: Filter by funding event type.

  • page_number (Integer) —

    Query param: Results page number. Starts at page 1.

  • page_size (Integer) —

    Query param: Results page size. Max value: 1000.

  • search_text (String, nil) —

    Query param: Free-text search across funding event fields.

  • sort_by (Symbol, Straddle::Models::FundingEventListParams::SortBy) —

    Query param: Field used to sort the results.

  • sort_order (Symbol, Straddle::Models::SortOrder) —

    Query param: Order in which to sort the results.

  • status (Array<Symbol, Straddle::Models::PaymentStatus>, nil) —

    Query param: Filter by funding event status.

  • status_reason (Array<Symbol, Straddle::Models::PaymentStatusReason>, nil) —

    Query param: Filter by the reason for the most recent status change.

  • status_source (Array<Symbol, Straddle::Models::PaymentStatusSource>, nil) —

    Query param: Filter by the source of the most recent status change.

  • trace_id (String, nil) —

    Query param: Filter by a network-level trace identifier assigned during processi

  • trace_number (String, nil) —

    Query param: Filter by a network trace number assigned during processing.

  • correlation_id (String) —

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

  • request_id (String) —

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

  • straddle_account_id (String) —

    Header param: For platform requests, the embedded account UUID that sets the req

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

Returns:

See Also:



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/straddle/resources/funding_events.rb', line 88

def list(params = {})
  query_params = %i[
    created_from
    created_to
    direction
    event_type
    page_number
    page_size
    search_text
    sort_by
    sort_order
    status
    status_reason
    status_source
    trace_id
    trace_number
  ]
  parsed, options = Straddle::FundingEventListParams.dump_request(params)
  query = Straddle::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "v1/funding_events",
    query: query,
    headers:
      parsed.except(*query_params).transform_keys(
        correlation_id: "correlation-id",
        request_id: "request-id",
        straddle_account_id: "straddle-account-id"
      ),
    model: Straddle::FundingEventSummaryList,
    options: options
  )
end

#list_payments(id, default_page_size: nil, default_sort: nil, default_sort_order: nil, include_metadata: nil, page_number: nil, page_size: nil, sort_by: nil, sort_order: nil, correlation_id: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::FundingEventPaymentList

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

Returns a paginated list of payments included in the funding event.

Parameters:

  • id (String) —

    Path param: Unique identifier for the funding event.

  • default_page_size (Integer) —

    Query param: Default number of results returned per page.

  • default_sort (Symbol, Straddle::Models::FundingEventListPaymentsParams::DefaultSort) —

    Query param: Default field used to sort the results.

  • default_sort_order (Symbol, Straddle::Models::SortOrder) —

    Query param: Default order in which to sort the results.

  • include_metadata (Boolean) —

    Query param: When true, includes each payment's metadata. Defaults to false.

  • page_number (Integer) —

    Query param: Results page number. Starts at 1. Defaults to 1.

  • page_size (Integer) —

    Query param: Number of results per page. Maximum 1,000. Defaults to 100.

  • sort_by (Symbol, Straddle::Models::FundingEventListPaymentsParams::SortBy) —

    Query param: Field used to sort the results.

  • sort_order (Symbol, Straddle::Models::SortOrder) —

    Query param: Order in which to sort the results.

  • correlation_id (String) —

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

  • request_id (String) —

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

  • straddle_account_id (String) —

    Header param: For platform requests, the embedded account UUID that sets the req

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

Returns:

See Also:



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/straddle/resources/funding_events.rb', line 158

def list_payments(id, params = {})
  query_params = %i[
    default_page_size
    default_sort
    default_sort_order
    include_metadata
    page_number
    page_size
    sort_by
    sort_order
  ]
  parsed, options = Straddle::FundingEventListPaymentsParams.dump_request(params)
  query = Straddle::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["v1/funding_event_payments/%1$s", id],
    query: query,
    headers:
      parsed.except(*query_params).transform_keys(
        correlation_id: "correlation-id",
        request_id: "request-id",
        straddle_account_id: "straddle-account-id"
      ),
    model: Straddle::FundingEventPaymentList,
    options: options
  )
end

#retrieve(id, correlation_id: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::FundingEventResponse

Returns a funding event by its unique identifier, including its current status, status history, and linked bank account details when available.

Parameters:

  • id (String) —

    Unique identifier for the funding event.

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

  • straddle_account_id (String) —

    For platform requests, the embedded account UUID that sets the request scope.

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

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/straddle/resources/funding_events.rb', line 26

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

#simulate(funding_event_job_type:, sandbox_outcome: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::FundingEventSimulation

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

Creates a funding event for unfunded charge or payout activity in the sandbox and returns its ID. This endpoint is unavailable in production.

Parameters:

  • funding_event_job_type (Symbol, Straddle::Models::FundingEventSimulateParams::FundingEventJobType) —

    Body param: Required. Selects charge or payout activity for the simulated fundin

  • sandbox_outcome (Symbol, Straddle::Models::SimulatedPaymentOutcome) —

    Body param: Optional. Sets the processing outcome for the simulated funding even

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

  • straddle_account_id (String) —

    Header param: For platform requests, the embedded account UUID that sets the req

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

Returns:

See Also:



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/straddle/resources/funding_events.rb', line 211

def simulate(params)
  parsed, options = Straddle::FundingEventSimulateParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id",
    straddle_account_id: "straddle-account-id"
  }
  @client.request(
    method: :post,
    path: "v1/funding_events/simulate",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::FundingEventSimulation,
    options: options
  )
end