Class: Lighthouse::DirectDeposit::PaymentInfoParser

Inherits:
Object
  • Object
show all
Defined in:
lib/lighthouse/direct_deposit/payment_info_parser.rb

Class Method Summary collapse

Class Method Details

.parse(response) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/lighthouse/direct_deposit/payment_info_parser.rb', line 8

def self.parse(response)
  return if response.nil? || response.body.nil?

  status = response.status
  control_info = parse_control_info(response.body['control_information'])
   = (response.body['payment_account'])

  Lighthouse::DirectDeposit::Response.new(status, control_info, )
end

.parse_control_info(control_information) ⇒ Object



18
19
20
21
22
23
# File 'lib/lighthouse/direct_deposit/payment_info_parser.rb', line 18

def self.parse_control_info(control_information)
  return if control_information.nil?

  control_information['has_identity'] = control_information.delete('has_indentity')
  control_information
end

.parse_payment_account(payment_account) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/lighthouse/direct_deposit/payment_info_parser.rb', line 25

def self.()
  return if .nil?

  {
    name: ['financial_institution_name'],
    account_type: ['account_type']&.capitalize,
    account_number: ['account_number'],
    routing_number: ['financial_institution_routing_number']
  }
end