Class: Ccavenue::Payment

Inherits:
Object
  • Object
show all
Defined in:
lib/ccavenue.rb

Instance Method Summary collapse

Constructor Details

#initialize(merchant_Id, working_Key, redirect_Url) ⇒ Payment

constructer to one time initialze genric keys



19
20
21
22
23
# File 'lib/ccavenue.rb', line 19

def initialize(merchant_Id,working_Key,redirect_Url)
	@merchant_Id = merchant_Id
	@redirect_Url = redirect_Url
	@working_Key = working_Key
end

Instance Method Details

#request(order_Id, amount, billing_cust_name, billing_cust_address, billing_cust_city, billing_zip_code, billing_cust_state, billing_cust_country, billing_cust_email, billing_cust_tel, billing_cust_notes = "", delivery_cust_name = "", delivery_cust_address = "", delivery_cust_city = "", delivery_zip_code = "", delivery_cust_state = "", delivery_cust_country = "", delivery_cust_email = "", delivery_cust_tel = "", delivery_cust_notes = "") ⇒ Object

request CCAvenue encrypted data



27
28
29
30
31
# File 'lib/ccavenue.rb', line 27

def request(order_Id,amount,billing_cust_name,billing_cust_address,billing_cust_city,billing_zip_code,billing_cust_state,billing_cust_country,billing_cust_email,billing_cust_tel,billing_cust_notes="",delivery_cust_name="",delivery_cust_address="",delivery_cust_city="",delivery_zip_code="",delivery_cust_state="",delivery_cust_country="",delivery_cust_email="",delivery_cust_tel="",delivery_cust_notes="")
	checksum = getChecksum(order_Id,amount)
	raw_request = "Merchant_Id=#{@merchant_Id}&Amount=#{amount}&Order_Id=#{order_Id}&Redirect_Url=#{@redirect_Url}&billing_cust_name=#{billing_cust_name}&billing_cust_address=#{billing_cust_address}&billing_cust_country=#{billing_cust_country}&billing_cust_state=#{billing_cust_state}&billing_cust_city=#{billing_cust_city}&billing_zip_code=#{billing_zip_code}&billing_cust_tel=#{billing_cust_tel}&billing_cust_email=#{billing_cust_email}&billing_cust_notes=#{billing_cust_notes}&delivery_cust_name=#{delivery_cust_name}&delivery_cust_address=#{delivery_cust_address}&delivery_cust_country=#{delivery_cust_country}&delivery_cust_state=#{delivery_cust_state}&delivery_cust_city=#{delivery_cust_city}&delivery_zip_code=#{delivery_zip_code}&delivery_cust_tel=#{delivery_cust_tel}&billing_cust_notes=#{delivery_cust_notes}&Checksum=#{checksum.to_s}"
	return encrypt_data(raw_request,@working_Key,"AES-128-CBC")[0]
end

#response(response) ⇒ Object

calling response method to check if everything went well



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ccavenue.rb', line 35

def response(response)
	raw_response = CGI::parse(decrypt_data(response,@working_Key,"AES-128-CBC"))

	auth_desc = raw_response["AuthDesc"][0]
	order_id = raw_response["Order_Id"][0]
	amount = raw_response["Amount"][0]
	checksum = raw_response["Checksum"][0]

	verification = verifyChecksum(order_id,amount,auth_desc,checksum)
	return auth_desc,verification,raw_response
end