Class: DebtManagementCenter::PaymentsService
- Inherits:
-
Object
- Object
- DebtManagementCenter::PaymentsService
- Includes:
- SentryLogging
- Defined in:
- lib/debt_management_center/payments_service.rb
Instance Method Summary collapse
-
#compensation_and_pension ⇒ Array<Hash>?
Returns a list of BGS Payment Hashes filtered by :payment_type == ‘Compensation & Pension - Recurring’ and sorted by :payment_date, ascending.
-
#education ⇒ Array<Hash>?
Returns a list of BGS Payment Hashes filtered by :payment_type == ‘Post-9/11 GI Bill’ and sorted by :payment_date, ascending.
-
#initialize(current_user) ⇒ DebtManagementCenter::PaymentsService
constructor
Retrieves the person and payments data, from BGS, that relates to the provided user.
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger
Constructor Details
#initialize(current_user) ⇒ DebtManagementCenter::PaymentsService
Retrieves the person and payments data, from BGS, that relates to the provided user.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/debt_management_center/payments_service.rb', line 14 def initialize(current_user) @person = begin BGS::People::Request.new.find_person_by_participant_id(user: current_user) rescue => e report_error(e) {} end @payments = begin BGS::PaymentService.new(current_user).payment_history(@person)[:payments][:payment].presence || [] rescue => e report_error(e) [] end end |
Instance Method Details
#compensation_and_pension ⇒ Array<Hash>?
Returns a list of BGS Payment Hashes filtered by :payment_type == ‘Compensation & Pension - Recurring’ and sorted by :payment_date, ascending.
Pending payments (where :payment_date == nil) are not included in the result.
40 41 42 |
# File 'lib/debt_management_center/payments_service.rb', line 40 def compensation_and_pension select_payments :compensation end |
#education ⇒ Array<Hash>?
Returns a list of BGS Payment Hashes filtered by :payment_type == ‘Post-9/11 GI Bill’ and sorted by :payment_date, ascending.
Pending payments (where :payment_date == nil) are not included in the result.
52 53 54 |
# File 'lib/debt_management_center/payments_service.rb', line 52 def education select_payments :education end |