Class: Payabli::CaseManagement::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/payabli/case_management/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ void

Parameters:



9
10
11
# File 'lib/payabli/case_management/client.rb', line 9

def initialize(client:)
  @client = client
end

Instance Method Details

#assign_case(request_options: {}, **params) ⇒ Payabli::Types::CaseResponse

Assigns a case to a reviewer.

Available to Enterprise Partners only.

Examples:

client.case_management.assign_case(
  uuid: "9c2b7e14-3a5f-4d21-b8e0-1f6a4c9d2e70",
  assignee_id: 4238,
  reason: "Routing to the risk team for review."
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :uuid (String)

Returns:



459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/payabli/case_management/client.rb', line 459

def assign_case(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::CaseManagement::Types::AssignCaseRequest.new(params).to_h
  non_body_param_names = %w[uuid]
  body = request_data.except(*non_body_param_names)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v2/cases/#{URI.encode_uri_component(params[:uuid].to_s)}/assign",
    headers: headers,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::CaseResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#create_bank_account_change(request_options: {}, **params) ⇒ Payabli::Types::CaseResponse

Creates a bank-account-change case for a paypoint. The account and routing numbers are validated and tokenized before the case is saved — the raw numbers are never stored or returned. The account holder name is taken from the paypoint's legal name. On success the case is created in Submitted and asynchronous verification starts.

Available to both Platform and Enterprise Partners.

Examples:

client.case_management.(
  paypoint_id: 3040,
  nickname: "Main Settlement Account",
  bank_name: "First National Bank",
  routing_number: "123456789",
  account_number: "987654321",
  account_type: "checking",
  bank_account_holder_type: "business",
  bank_account_function: "Deposits",
  services: {
    money_in: ["Ach"],
    money_out: ["Ach"]
  },
  default: true
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :paypoint_id (Integer)

Returns:



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/payabli/case_management/client.rb', line 108

def (request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::CaseManagement::Types::CreateBankAccountChangeCaseRequest.new(params).to_h
  non_body_param_names = %w[paypointId]
  body = request_data.except(*non_body_param_names)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v2/cases/bank-account/#{URI.encode_uri_component(params[:paypoint_id].to_s)}",
    headers: headers,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::CaseResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#delete_attachment(request_options: {}, **params) ⇒ untyped

Deletes an attachment from a case.

Available to both Platform and Enterprise Partners.

Examples:

client.case_management.delete_attachment(
  case_uuid: "caseUuid",
  attachment_id: "attachmentId"
)

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :case_uuid (String)
  • :attachment_id (String)

Returns:

  • (untyped)

Raises:

  • (error_class)


639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
# File 'lib/payabli/case_management/client.rb', line 639

def delete_attachment(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "DELETE",
    path: "v2/cases/#{URI.encode_uri_component(params[:case_uuid].to_s)}/attachments/#{URI.encode_uri_component(params[:attachment_id].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#get_attachment(request_options: {}, **params) ⇒ untyped

Streams the file content of an attachment.

Available to both Platform and Enterprise Partners.

Examples:

client.case_management.get_attachment(
  case_uuid: "caseUuid",
  attachment_id: "attachmentId"
)

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :case_uuid (String)
  • :attachment_id (String)

Returns:

  • (untyped)

Raises:

  • (error_class)


596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
# File 'lib/payabli/case_management/client.rb', line 596

def get_attachment(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v2/cases/#{URI.encode_uri_component(params[:case_uuid].to_s)}/attachments/#{URI.encode_uri_component(params[:attachment_id].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#get_case(request_options: {}, **params) ⇒ Payabli::Types::CaseResponse

Returns a case by its UUID, including its current state, parameters, state history, verification metadata, and attachments.

Available to both Platform and Enterprise Partners.

Examples:

client.case_management.get_case(uuid: "9c2b7e14-3a5f-4d21-b8e0-1f6a4c9d2e70")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :uuid (String)

Returns:



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/payabli/case_management/client.rb', line 155

def get_case(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v2/cases/#{URI.encode_uri_component(params[:uuid].to_s)}",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::CaseResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_attachments(request_options: {}, **params) ⇒ Array[Payabli::Types::AttachmentResponse]

Lists the files attached to a case.

Available to both Platform and Enterprise Partners.

Examples:

client.case_management.list_attachments(case_uuid: "9c2b7e14-3a5f-4d21-b8e0-1f6a4c9d2e70")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :case_uuid (String)

Returns:

Raises:

  • (error_class)


505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/payabli/case_management/client.rb', line 505

def list_attachments(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v2/cases/#{URI.encode_uri_component(params[:case_uuid].to_s)}/attachments",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#list_cases(request_options: {}, **params) ⇒ Payabli::Types::CaseListResponse

Lists cases for an organization, climbing the platform org hierarchy. Supports pagination and sorting through query parameters, and filtering through repeatable parameters[field(op)]=value query parameters (for example parameters[state(in)]=Assigned|PendingReview). Filterable fields include state, caseType, paypointId, createdAt, updatedAt, scheduleFor, and createdBy.

Available to both Platform and Enterprise Partners.

Examples:

client.case_management.list_cases(
  organization_id: 123,
  from_record: 0,
  limit_record: 20
)

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :organization_id (Integer)
  • :from_record (Integer, nil)
  • :limit_record (Integer, nil)
  • :sort_by (String, nil)

Returns:



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/payabli/case_management/client.rb', line 208

def list_cases(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["fromRecord"] = params[:from_record] if params.key?(:from_record)
  query_params["limitRecord"] = params[:limit_record] if params.key?(:limit_record)
  query_params["sortBy"] = params[:sort_by] if params.key?(:sort_by)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v2/cases/organization/#{URI.encode_uri_component(params[:organization_id].to_s)}",
    headers: headers,
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::CaseListResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_messages(request_options: {}, **params) ⇒ Payabli::Types::MessagePage

Lists the notes on a case, ordered oldest to newest. Cursor-paginated.

Available to both Platform and Enterprise Partners.

Examples:

client.case_management.list_messages(case_uuid: "9c2b7e14-3a5f-4d21-b8e0-1f6a4c9d2e70")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :case_uuid (String)
  • :limit (Integer, nil)
  • :cursor (String, nil)

Returns:



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/payabli/case_management/client.rb', line 257

def list_messages(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["limit"] = params[:limit] if params.key?(:limit)
  query_params["cursor"] = params[:cursor] if params.key?(:cursor)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v2/cases/#{URI.encode_uri_component(params[:case_uuid].to_s)}/messages",
    headers: headers,
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::MessagePage.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_transitions(request_options: {}, **params) ⇒ Payabli::Types::AvailableTransitionsResponse

Lists the review actions currently available on a case. The list is empty when no user action is available (for example while the case is mid-automation).

Available to both Platform and Enterprise Partners, though only Enterprise Partners can fire the returned actions.

Examples:

client.case_management.list_transitions(uuid: "9c2b7e14-3a5f-4d21-b8e0-1f6a4c9d2e70")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :uuid (String)

Returns:



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/payabli/case_management/client.rb', line 361

def list_transitions(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v2/cases/#{URI.encode_uri_component(params[:uuid].to_s)}/transitions",
    headers: headers,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::AvailableTransitionsResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#post_message(request_options: {}, **params) ⇒ Payabli::Types::PostedMessage

Adds a note to a case.

Available to both Platform and Enterprise Partners.

This endpoint is in development and not yet available for API use. To add a note for now, use Case Management in the Payabli Portal. To read existing notes on a case, use List case notes.

Examples:

client.case_management.post_message(
  case_uuid: "9c2b7e14-3a5f-4d21-b8e0-1f6a4c9d2e70",
  content: "Reviewed supporting documents; account ownership confirmed."
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :case_uuid (String)

Returns:



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/payabli/case_management/client.rb', line 312

def post_message(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::CaseManagement::Types::PostCaseMessageRequest.new(params).to_h
  non_body_param_names = %w[caseUuid]
  body = request_data.except(*non_body_param_names)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v2/cases/#{URI.encode_uri_component(params[:case_uuid].to_s)}/messages",
    headers: headers,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PostedMessage.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#transition(request_options: {}, **params) ⇒ Payabli::Types::CaseResponse

Fires a review action on a case, such as Approve, Deny, Escalate, or RequestReview. Assigning a case uses the dedicated assign endpoint, not this one. Firing an action that isn't valid for the case's current state returns 409.

Available to Enterprise Partners only.

Examples:

client.case_management.transition(
  uuid: "9c2b7e14-3a5f-4d21-b8e0-1f6a4c9d2e70",
  trigger: "Approve",
  reason: "Account ownership confirmed with the merchant by phone."
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :uuid (String)

Returns:



409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/payabli/case_management/client.rb', line 409

def transition(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::CaseManagement::Types::TransitionCaseRequest.new(params).to_h
  non_body_param_names = %w[uuid]
  body = request_data.except(*non_body_param_names)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v2/cases/#{URI.encode_uri_component(params[:uuid].to_s)}/transitions",
    headers: headers,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::CaseResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#upload_attachment(request_options: {}, **params) ⇒ Payabli::Types::AttachmentResponse

Uploads a file to a case as multipart form data. The maximum size is 25 MiB, and the content type must be an allowed type such as PDF, PNG, JPEG, CSV, XLSX, DOCX, or plain text.

Available to both Platform and Enterprise Partners.

Examples:

client.case_management.upload_attachment(case_uuid: "caseUuid")

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (void)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :case_uuid (String)

Returns:



546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
# File 'lib/payabli/case_management/client.rb', line 546

def upload_attachment(request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  body = Internal::Multipart::FormData.new

  body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file]

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::Multipart::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v2/cases/#{URI.encode_uri_component(params[:case_uuid].to_s)}/attachments",
    headers: headers,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::AttachmentResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#validate_bank_account_change(request_options: {}, **params) ⇒ Payabli::Types::PreCreationValidationResult

Validates a bank account change for a paypoint without creating a case. Runs the same checks the create endpoint runs, and returns blocking conditions and warnings. Blocking conditions prevent creation; warnings don't.

Available to both Platform and Enterprise Partners.

Examples:

client.case_management.(
  paypoint_id: 3040,
  routing_number: "123456789",
  account_number: "987654321",
  account_type: "checking",
  bank_account_holder_type: "business",
  bank_account_function: "Deposits",
  services: {
    money_in: ["Ach"],
    money_out: ["Ach"]
  }
)

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :paypoint_id (Integer)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/payabli/case_management/client.rb', line 44

def (request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::CaseManagement::Types::ValidateBankAccountChangeRequest.new(params).to_h
  non_body_param_names = %w[paypointId]
  body = request_data.except(*non_body_param_names)

  headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }])
  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v2/cases/bank-account/#{URI.encode_uri_component(params[:paypoint_id].to_s)}/validate",
    headers: headers,
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Payabli::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Payabli::Types::PreCreationValidationResult.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end