Class: LighthousePPIUProvider

Inherits:
Object
  • Object
show all
Includes:
PPIUProvider
Defined in:
lib/disability_compensation/providers/ppiu_direct_deposit/lighthouse_ppiu_provider.rb

Instance Method Summary collapse

Methods included from PPIUProvider

get_payment_information

Constructor Details

#initialize(current_user) ⇒ LighthousePPIUProvider

Returns a new instance of LighthousePPIUProvider.



10
11
12
# File 'lib/disability_compensation/providers/ppiu_direct_deposit/lighthouse_ppiu_provider.rb', line 10

def initialize(current_user)
  @service = DirectDeposit::Client.new(current_user.icn)
end

Instance Method Details

#get_payment_information(_lighthouse_client_id = nil, _lighthouse_rsa_key_path = nil) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/disability_compensation/providers/ppiu_direct_deposit/lighthouse_ppiu_provider.rb', line 14

def get_payment_information(_lighthouse_client_id = nil, _lighthouse_rsa_key_path = nil)
  data = @service.get_payment_info
  # return value of get_payment_info is a hash with symbols.
  # Lighthouse::DirectDeposit::Response
  # transform accordingly
  transform(data)
end

#populate_control_information(data) ⇒ Object (private)



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/disability_compensation/providers/ppiu_direct_deposit/lighthouse_ppiu_provider.rb', line 35

def populate_control_information(data)
  DisabilityCompensation::ApiProvider::ControlInformation.new(
    can_update_address: false,
    corp_avail_indicator: data.control_information[:is_corp_available],
    corp_rec_found_indicator: data.control_information[:is_corp_rec_found],
    has_no_bdn_payments_indicator: data.control_information[:has_no_bdn_payments],
    identity_indicator: data.control_information[:has_identity],
    is_competent_indicator: data.control_information[:is_competent],
    index_indicator: data.control_information[:has_index],
    no_fiduciary_assigned_indicator: data.control_information[:has_no_fiduciary_assigned],
    not_deceased_indicator: data.control_information[:is_not_deceased]
  )
end

#populate_payment_account(data) ⇒ Object (private)



49
50
51
52
53
54
55
56
# File 'lib/disability_compensation/providers/ppiu_direct_deposit/lighthouse_ppiu_provider.rb', line 49

def (data)
  DisabilityCompensation::ApiProvider::PaymentAccount.new(
    account_type: data.[:account_type],
    financial_institution_name: data.[:name],
    account_number: data.[:account_number],
    financial_institution_routing_number: data.[:routing_number]
  )
end

#transform(data) ⇒ Object (private)



24
25
26
27
28
29
30
31
32
33
# File 'lib/disability_compensation/providers/ppiu_direct_deposit/lighthouse_ppiu_provider.rb', line 24

def transform(data)
  DisabilityCompensation::ApiProvider::PaymentInformationResponse.new(
    responses: [
      DisabilityCompensation::ApiProvider::PaymentInformation.new(
        control_information: populate_control_information(data),
        payment_account: (data)
      )
    ]
  )
end