Class: Lighthouse::DirectDeposit::PaymentInfoParser
- Inherits:
-
Object
- Object
- Lighthouse::DirectDeposit::PaymentInfoParser
- Defined in:
- lib/lighthouse/direct_deposit/payment_info_parser.rb
Class Method Summary collapse
- .parse(response) ⇒ Object
- .parse_control_info(control_information) ⇒ Object
- .parse_payment_account(payment_account) ⇒ Object
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']) payment_account = parse_payment_account(response.body['payment_account']) Lighthouse::DirectDeposit::Response.new(status, control_info, payment_account) 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.parse_payment_account(payment_account) return if payment_account.nil? { name: payment_account['financial_institution_name'], account_type: payment_account['account_type']&.capitalize, account_number: payment_account['account_number'], routing_number: payment_account['financial_institution_routing_number'] } end |