Class: BGS::PaymentService

Inherits:
Object
  • Object
show all
Includes:
SentryLogging
Defined in:
app/services/bgs/payment_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Constructor Details

#initialize(user) ⇒ PaymentService

Returns a new instance of PaymentService.



9
10
11
12
13
# File 'app/services/bgs/payment_service.rb', line 9

def initialize(user)
  @common_name = user.common_name
  @email = user.email
  @icn = user.icn
end

Instance Attribute Details

#common_nameObject (readonly)

Returns the value of attribute common_name.



7
8
9
# File 'app/services/bgs/payment_service.rb', line 7

def common_name
  @common_name
end

#emailObject (readonly)

Returns the value of attribute email.



7
8
9
# File 'app/services/bgs/payment_service.rb', line 7

def email
  @email
end

#icnObject (readonly)

Returns the value of attribute icn.



7
8
9
# File 'app/services/bgs/payment_service.rb', line 7

def icn
  @icn
end

Instance Method Details

#payment_history(person) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/services/bgs/payment_service.rb', line 15

def payment_history(person)
  response = service.payment_information.retrieve_payment_summary_with_bdn(
    person.participant_id,
    person.file_number,
    '00', # payee code
    person.ssn_number
  )
  return empty_response if response[:payments].nil?

  response
rescue => e
  log_exception_to_sentry(e, { icn: }, { team: Constants::SENTRY_REPORTING_TEAM })
  empty_response if e.message.include?('No Data Found')
end