Class: Saman::Client
- Inherits:
-
Object
- Object
- Saman::Client
- Defined in:
- lib/saman/verify.rb,
lib/saman/authorize.rb,
lib/saman/health_check.rb
Overview
Client class to handle requests
Instance Method Summary collapse
- #authorize(params) ⇒ Object
- #authorize_up? ⇒ Boolean
- #health_check ⇒ Object
- #verify(params) ⇒ Object
- #verify_up? ⇒ Boolean
Instance Method Details
#authorize(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/saman/authorize.rb', line 7 def (params) config = Saman.configuration request_parameters = (params) response = send_rest_requests( config., request_parameters, config.retry_count ) raise response[:error] unless response.is_a? RestClient::Response (response) end |
#authorize_up? ⇒ Boolean
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/saman/health_check.rb', line 22 def = Savon.client(wsdl: Saman.configuration.) = %i[ request_token request_multi_settle_type_token ] ( - .operations).empty? rescue StandardError return false end |
#health_check ⇒ Object
6 7 8 |
# File 'lib/saman/health_check.rb', line 6 def health_check && verify_up? end |
#verify(params) ⇒ Object
7 8 9 10 |
# File 'lib/saman/verify.rb', line 7 def verify(params) return false unless params[:State] == 'OK' verify_the_payment(params) end |
#verify_up? ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/saman/health_check.rb', line 10 def verify_up? verify_client = Savon.client(wsdl: Saman.configuration.verify_wsdl) expected_operations_for_verify = %i[ verify_transaction verify_transaction1 ] (expected_operations_for_verify - verify_client.operations).empty? rescue StandardError return false end |