class ActiveMerchant::Billing::EpsilonBaseGateway
This is the base gateway for concrete payment gateway for Epsilon
Create a new EpsilonGatway¶ ↑
class EpsilonSampleGateway < EpsilonBaseGateway
def purchase(amount, payment_method, detail = {}) request_params = { contract_code: self.contract_code, user_id: detail[:user_id], item_code: detail[:item_code], order_number: detail[:order_number], item_price: amount, } request_path = 'purchase' commit(request_path, request_paramsparams) end
end
Constants
- DEFAULT_RESPONSE_KEYS
Private Instance Methods
Source
# File lib/active_merchant/billing/gateways/epsilon/epsilon_base.rb, line 59 def commit(path, request_params, response_keys = DEFAULT_RESPONSE_KEYS) parser = ResponseParser.new url = (test? ? test_url : live_url) response = parser.parse(ssl_post(File.join(url, path), post_data(request_params)), response_keys) options = { authorization: authorization_from(response), test: test? } Response.new(success_from(response), message_from(response), response, options) end
Source
# File lib/active_merchant/billing/gateways/epsilon/epsilon_base.rb, line 77 def encode_value(value) return value unless encoding value.encode(encoding, invalid: :replace, undef: :replace) end
Source
# File lib/active_merchant/billing/gateways/epsilon/epsilon_base.rb, line 82 def message_from(response) response[:message] end
Source
# File lib/active_merchant/billing/gateways/epsilon/epsilon_base.rb, line 73 def post_data(parameters = {}) parameters.map { |k, v| "#{k}=#{CGI.escape(encode_value(v.to_s))}" }.join('&') end
Source
# File lib/active_merchant/billing/gateways/epsilon/epsilon_base.rb, line 86 def success_from(response) response[:success] end