Class: EVSS::PPIU::Service

Inherits:
Service show all
Defined in:
lib/evss/ppiu/service.rb

Overview

Proxy Service for EVSS’s PPIU endpoints. For the foreseeable future, EVSS will only support the ‘CNP’ (Compensation and Pension) payment type and is therefore statically assigned in the request payloads.

Constant Summary

Constants inherited from Service

Service::STATSD_KEY_PREFIX

Instance Attribute Summary

Attributes inherited from Service

#transaction_id

Instance Method Summary collapse

Methods inherited from Service

#headers, #perform, service_is_up?

Methods included from Common::Client::Concerns::Monitoring

#with_monitoring

Methods inherited from Common::Client::Base

configuration, #raise_backend_exception

Methods included from SentryLogging

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

Constructor Details

#initialize(*args) ⇒ Service

Returns a new instance of Service.



18
19
20
21
22
# File 'lib/evss/ppiu/service.rb', line 18

def initialize(*args)
  super

  raise Common::Exceptions::Unauthorized unless PPIUPolicy.new(@user).access?
end

Instance Method Details

#get_payment_informationEVSS::PPIU::PaymentInformationResponse

GETs a user’s payment information

Returns:



28
29
30
31
32
33
# File 'lib/evss/ppiu/service.rb', line 28

def get_payment_information
  with_monitoring_and_error_handling do
    raw_response = perform(:get, 'paymentInformation', paymentType: 'CNP')
    PaymentInformationResponse.new(raw_response.status, raw_response)
  end
end

#update_payment_information(pay_info) ⇒ EVSS::PPIU::PaymentInformationResponse

POSTs a user’s payment information to EVSS and updates their current information

Parameters:

  • pay_info (JSON)

    JSON serialized banking account information

Returns:



40
41
42
43
44
45
46
47
48
# File 'lib/evss/ppiu/service.rb', line 40

def update_payment_information(pay_info)
  body = request_body(pay_info)
  save_sanitized_req_body(body)

  with_monitoring_and_error_handling do
    raw_response = perform(:post, 'paymentInformation', body, headers)
    PaymentInformationResponse.new(raw_response.status, raw_response)
  end
end