Class: AgendrixBankingDetailsResolver
- Inherits:
-
Object
- Object
- AgendrixBankingDetailsResolver
- Defined in:
- app/resolver/agendrix_banking_details_resolver.rb
Defined Under Namespace
Classes: Actions
Constant Summary collapse
- HR_PRIVATE_DATA_BANKING_DETAILS_KEY =
'3128733b-e2e9-40c5-8569-5ee9a816fe3e'- USER_NAME =
'SYSTEM'
Instance Attribute Summary collapse
-
#company_id ⇒ Object
readonly
Returns the value of attribute company_id.
-
#employee_id ⇒ Object
readonly
Returns the value of attribute employee_id.
-
#hr_private_data ⇒ Object
readonly
Returns the value of attribute hr_private_data.
-
#member_id ⇒ Object
readonly
Returns the value of attribute member_id.
Instance Method Summary collapse
-
#initialize(company_id:, employee_id:, member_id:, hr_private_data:) ⇒ AgendrixBankingDetailsResolver
constructor
A new instance of AgendrixBankingDetailsResolver.
- #resolve ⇒ Object
Constructor Details
#initialize(company_id:, employee_id:, member_id:, hr_private_data:) ⇒ AgendrixBankingDetailsResolver
Returns a new instance of AgendrixBankingDetailsResolver.
14 15 16 17 18 19 |
# File 'app/resolver/agendrix_banking_details_resolver.rb', line 14 def initialize(company_id:, employee_id:, member_id:, hr_private_data:) @company_id = company_id @employee_id = employee_id @member_id = member_id @hr_private_data = hr_private_data.with_indifferent_access end |
Instance Attribute Details
#company_id ⇒ Object (readonly)
Returns the value of attribute company_id.
12 13 14 |
# File 'app/resolver/agendrix_banking_details_resolver.rb', line 12 def company_id @company_id end |
#employee_id ⇒ Object (readonly)
Returns the value of attribute employee_id.
12 13 14 |
# File 'app/resolver/agendrix_banking_details_resolver.rb', line 12 def employee_id @employee_id end |
#hr_private_data ⇒ Object (readonly)
Returns the value of attribute hr_private_data.
12 13 14 |
# File 'app/resolver/agendrix_banking_details_resolver.rb', line 12 def hr_private_data @hr_private_data end |
#member_id ⇒ Object (readonly)
Returns the value of attribute member_id.
12 13 14 |
# File 'app/resolver/agendrix_banking_details_resolver.rb', line 12 def member_id @member_id end |
Instance Method Details
#resolve ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/resolver/agendrix_banking_details_resolver.rb', line 21 def resolve ActiveRecord::Base.transaction do if find_integrated_bank_account update_bank_account { action: Actions::UPDATE, hr_private_data: hr_private_data, bank_account: @bank_account } elsif find_bank_account_to_integrate integrate_bank_account update_bank_account { action: Actions::INTEGRATE, hr_private_data: hr_private_data, bank_account: @bank_account } elsif create_bank_account integrate_bank_account { action: Actions::CREATE, hr_private_data: hr_private_data, bank_account: @bank_account } end end rescue StandardError => e Rails.logger.error "Failed to resolve Agendrix member: #{e.}" raise e end |