module CcavenuePayment

Constants

VERSION

Public Class Methods

access_code() click to toggle source
# File lib/ccavenue_payment.rb, line 27
def access_code
  @access_code ||= Config.access_code
end
decrypted_data(encrypted_string) click to toggle source
# File lib/ccavenue_payment.rb, line 15
def decrypted_data(encrypted_string)
  crypto.decrypt(encrypted_string)
end
encrypted_data(data) click to toggle source

Create request object

Options(Hash)

# File lib/ccavenue_payment.rb, line 9
def encrypted_data(data)
  #query_string = data.merge!({ merchant_id: Config.merchant_id }).to_query
  query_string = hash_to_query(data.merge!({ merchant_id: Config.merchant_id }))
  crypto.encrypt(query_string)
end
request_url() click to toggle source
# File lib/ccavenue_payment.rb, line 19
def request_url
  if Config.mode.upcase == 'TEST'
    "https://test.ccavenue.com/transaction/transaction.do?command=initiateTransaction"
  elsif Config.mode.upcase == 'LIVE'
    "https://secure.ccavenue.com/transaction/transaction.do?command=initiateTransaction"
  end
end

Private Class Methods

crypto() click to toggle source
# File lib/ccavenue_payment.rb, line 33
def crypto
  @crypto ||= Crypto.new(working_key: Config.working_key)
end
hash_to_query(hash) click to toggle source
# File lib/ccavenue_payment.rb, line 37
def hash_to_query(hash)
  URI.encode(hash.map{|k,v| "#{k}=#{v}"}.join("&"))
end