Class: EVSS::PPIU::Service
- Inherits:
-
Service
- Object
- Common::Client::Base
- Service
- EVSS::PPIU::Service
- 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
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#get_payment_information ⇒ EVSS::PPIU::PaymentInformationResponse
GETs a user’s payment information.
-
#initialize(*args) ⇒ Service
constructor
A new instance of Service.
-
#update_payment_information(pay_info) ⇒ EVSS::PPIU::PaymentInformationResponse
POSTs a user’s payment information to EVSS and updates their current information.
Methods inherited from Service
#headers, #perform, service_is_up?
Methods included from Common::Client::Concerns::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_information ⇒ EVSS::PPIU::PaymentInformationResponse
GETs a user’s payment information
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
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 |