Class: Straddle::Resources::Paykeys

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

Overview

A paykey links a verified customer to a bank account without exposing bank account details. Use a paykey to create charges and payouts.

Defined Under Namespace

Classes: Review

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Paykeys

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

Parameters:



350
351
352
353
# File 'lib/straddle/resources/paykeys.rb', line 350

def initialize(client:)
  @client = client
  @review = Straddle::Resources::Paykeys::Review.new(client: client)
end

Instance Attribute Details

#review ⇒ Straddle::Resources::Paykeys::Review (readonly)

A paykey links a verified customer to a bank account without exposing bank account details. Use a paykey to create charges and payouts.



11
12
13
# File 'lib/straddle/resources/paykeys.rb', line 11

def review
  @review
end

Instance Method Details

#cancel(id, reason: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PaykeyResponse

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

Cancels a paykey so it cannot be used for new payments.

Parameters:

  • id (String) —

    Path param: Unique identifier for the paykey.

  • reason (String, nil) —

    Body param: Reason for canceling the paykey.

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



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/straddle/resources/paykeys.rb', line 143

def cancel(id, params = {})
  parsed, options = Straddle::PaykeyCancelParams.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: :put,
    path: ["v1/paykeys/%1$s/cancel", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::PaykeyResponse,
    options: options
  )
end

#list(created_from: nil, created_to: nil, customer_id: nil, page_number: nil, page_size: nil, search_text: nil, sort_by: nil, sort_order: nil, source: nil, status: nil, unblock_eligible: nil, correlation_id: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PaykeySummaryList

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

Returns a paginated list of paykeys for the account. Optional query parameters filter, search, and sort the results.

Parameters:

  • created_from (Time) —

    Query param: Start date for filtering by creation date.

  • created_to (Time) —

    Query param: End date for filtering by creation date.

  • customer_id (String) —

    Query param: Filter paykeys by related customer ID.

  • page_number (Integer) —

    Query param: Page number for paginated results. Starts at 1.

  • page_size (Integer) —

    Query param: Number of results per page. Maximum: 1000.

  • search_text (String) —

    Query param: General search term to filter paykeys.

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

    Query param: Field used to sort the results.

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

    Query param: Order in which to sort the results.

  • source (Array<Symbol, Straddle::Models::PaykeySource>) —

    Query param: Filter paykeys by their source.

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

    Query param: Filter paykeys by their current status.

  • unblock_eligible (Boolean) —

    Query param: Filters paykeys by unblock eligibility. true returns blocked payk

  • 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
# File 'lib/straddle/resources/paykeys.rb', line 88

def list(params = {})
  query_params = %i[
    created_from
    created_to
    customer_id
    page_number
    page_size
    search_text
    sort_by
    sort_order
    source
    status
    unblock_eligible
  ]
  parsed, options = Straddle::PaykeyListParams.dump_request(params)
  query = Straddle::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "v1/paykeys",
    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::PaykeySummaryList,
    options: options
  )
end

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

Returns a paykey by id, including the full paykey value and unmasked bank account details. Straddle must enable this endpoint for your account. Use this endpoint only when unmasked data is necessary.

Parameters:

  • id (String) —

    Unique identifier for the paykey.

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



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/straddle/resources/paykeys.rb', line 180

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

#refresh_balance(id, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PaykeyResponse

Starts an asynchronous balance refresh for a paykey. The response returns the paykey before the refresh finishes.

Parameters:

  • id (String) —

    Unique identifier for the paykey.

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

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



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/straddle/resources/paykeys.rb', line 216

def refresh_balance(id, params = {})
  parsed, options = Straddle::PaykeyRefreshBalanceParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["v1/paykeys/%1$s/refresh_balance", id],
    headers:
      parsed.transform_keys(
        correlation_id: "correlation-id",
        idempotency_key: "idempotency-key",
        request_id: "request-id",
        straddle_account_id: "straddle-account-id"
      ),
    model: Straddle::PaykeyResponse,
    options: options
  )
end

#refresh_review(id, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PaykeyResponse

Starts a new verification review for a paykey. The review runs asynchronously. Webhooks and the paykey review endpoint return updated results.

Parameters:

  • id (String) —

    Unique identifier for the paykey.

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

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



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/straddle/resources/paykeys.rb', line 253

def refresh_review(id, params = {})
  parsed, options = Straddle::PaykeyRefreshReviewParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["v1/paykeys/%1$s/refresh_review", id],
    headers:
      parsed.transform_keys(
        correlation_id: "correlation-id",
        idempotency_key: "idempotency-key",
        request_id: "request-id",
        straddle_account_id: "straddle-account-id"
      ),
    model: Straddle::PaykeyResponse,
    options: options
  )
end

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

Returns a paykey by id, including the masked paykey value and bank account details.

Parameters:

  • id (String) —

    Unique identifier for the paykey.

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



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/straddle/resources/paykeys.rb', line 31

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

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

Returns a paykey by id, including the full paykey value and masked bank account details.

Parameters:

  • id (String) —

    Unique identifier for the paykey.

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



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/straddle/resources/paykeys.rb', line 288

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

#unblock(id, message: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, straddle_account_id: nil, request_options: {}) ⇒ Straddle::Models::PaykeyResponse

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

Unblocks a paykey that was blocked by an R29 return. The paykey must not have been unblocked before.

Parameters:

  • id (String) —

    Path param: Unique identifier for the paykey.

  • message (String, nil) —

    Body param: Optional message describing the reason for unblocking.

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



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/straddle/resources/paykeys.rb', line 329

def unblock(id, params = {})
  parsed, options = Straddle::PaykeyUnblockParams.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: :patch,
    path: ["v1/paykeys/%1$s/unblock", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::PaykeyResponse,
    options: options
  )
end