class PaymentGateway::ForAll::Base
Public Class Methods
new()
click to toggle source
# File lib/payment_gateway/for_all/base.rb, line 8 def initialize raise MerchantKeyNotFound if PaymentGateway::ForAll.configuration.merchant_key.blank? end
Protected Instance Methods
access_key()
click to toggle source
# File lib/payment_gateway/for_all/base.rb, line 31 def access_key Vault.new.request_key end
api_url()
click to toggle source
# File lib/payment_gateway/for_all/base.rb, line 27 def api_url PaymentGateway::ForAll.configuration.environment end
request(method, url, options={ body: {}, params: {} })
click to toggle source
# File lib/payment_gateway/for_all/base.rb, line 14 def request(method, url, options={ body: {}, params: {} }) options[:body].merge!({'merchantKey': PaymentGateway::ForAll.configuration.merchant_key}) response = HTTP. headers('Content-Type' => 'application/json'). send(method, url, json: options[:body].with_indifferent_access) if response.status.eql?(200) response.parse.with_indifferent_access else error_message = "#{response.status} - #{response.parse['error']['message']}" raise GatewayError, error_message end end