class OffsitePayments::Integrations::Latipay::TransactionInterface
Public Class Methods
url()
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 88 def self.url "#{base_url}/transaction" end
Public Instance Methods
call(options)
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 92 def call(options) options[:signature] = self.sign(options) raw_response = ssl_post(self.class.url, options.to_json, standard_headers) parsed_response = parse_response(raw_response) validate_response(parsed_response) "#{parsed_response['host_url']}/#{parsed_response['nonce']}" end
validate_response(parsed_response)
click to toggle source
# File lib/offsite_payments/integrations/latipay.rb, line 100 def validate_response(parsed_response) raise TransactionRequestError, parsed_response unless parsed_response['code'] == 0 message = parsed_response['nonce'] + parsed_response['host_url'] signature = parsed_response['signature'] raise StandardError, 'Invalid Signature in response' unless verify_signature(message, signature) end