Class: Payabli::Management::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ void

Parameters:



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

def initialize(client:)
  @client = client
end

Instance Method Details

#verify_account_details(request_options: {}, **params) ⇒ Payabli::Management::Types::VerifyAccountDetailsResponse

Verifies a bank account and returns detailed verification results from the verification network, including bank name, account status, and response codes. Unlike a pass/fail verification, this endpoint returns granular data to support decision-making and troubleshooting.

When bank authentication is enabled for the paypoint’s organization, the endpoint performs an identity verification check on the account holder. Otherwise, it performs an account existence check. When bank authentication is enabled, the ‘accountHolderType` and `holderName` fields are required.

Requires ‘inboundpayments_create` or `outboundpayments_create` permission.

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

  • :entry (String)

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/payabli/management/client.rb', line 33

def (request_options: {}, **params)
  params = Payabli::Internal::Types::Utils.normalize_keys(params)
  request_data = Payabli::Management::Types::VerifyAccountDetailsRequest.new(params).to_h
  non_body_param_names = ["entry"]
  body = request_data.except(*non_body_param_names)

  request = Payabli::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "Management/verifyAccountDetails/#{URI.encode_uri_component(params[:entry].to_s)}",
    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::Management::Types::VerifyAccountDetailsResponse.load(response.body)
  else
    error_class = Payabli::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end