class OffsitePayments::Integrations::Latipay::Interface
Public Class Methods
base_url()
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 16 def self.base_url "https://api.latipay.net/v2" end
new(api_key, user_id)
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 20 def initialize(api_key, user_id) @api_key = api_key @user_id = user_id end
Public Instance Methods
sign(fields)
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 25 def sign(fields) message = fields.compact.sort.map{ |k,v| "#{k.to_s}=#{v}" }.join('&').concat(@api_key) OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA256.new, @api_key, message) end
verify_signature(message, signature)
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 30 def verify_signature(message, signature) signature == OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA256.new, @api_key, message) end
Private Instance Methods
parse_response(raw_response)
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 42 def parse_response(raw_response) JSON.parse(raw_response) end
standard_headers()
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 36 def standard_headers { 'Content-Type' => 'application/json' } end