active_merchant_ccavenue 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,24 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## Netbeans
17
+ nbproject
18
+
19
+ ## PROJECT::GENERAL
20
+ coverage
21
+ rdoc
22
+ pkg
23
+
24
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Suman Debnath
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,7 @@
1
+ = active_merchant_ccavenue
2
+
3
+ CCAvenue integration for ActiveMerchant.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2010 Suman Debnath. See LICENSE for details.
@@ -0,0 +1,45 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = 'active_merchant_ccavenue'
8
+ gem.summary = %Q{ActiveMerchantCCAvenue}
9
+ gem.description = %Q{CCAvenue integration for ActiveMerchant}
10
+ gem.email = 'contact@meshbrain.com'
11
+ gem.homepage = 'http://github.com/meshbrain/active_merchant_ccavenue'
12
+ gem.authors = ['Suman Debnath']
13
+ gem.add_development_dependency 'rspec', '>= 1.2.9'
14
+ gem.add_dependency 'activemerchant', '>= 1.7.3'
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
19
+ end
20
+
21
+ require 'spec/rake/spectask'
22
+ Spec::Rake::SpecTask.new(:spec) do |spec|
23
+ spec.libs << 'lib' << 'spec'
24
+ spec.spec_files = FileList['spec/**/*_spec.rb']
25
+ end
26
+
27
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
28
+ spec.libs << 'lib' << 'spec'
29
+ spec.pattern = 'spec/**/*_spec.rb'
30
+ spec.rcov = true
31
+ end
32
+
33
+ task :spec => :check_dependencies
34
+
35
+ task :default => :spec
36
+
37
+ require 'rake/rdoctask'
38
+ Rake::RDocTask.new do |rdoc|
39
+ version = File.exist?('VERSION') ? File.read('VERSION') : ''
40
+
41
+ rdoc.rdoc_dir = 'rdoc'
42
+ rdoc.title = "active_merchant_ccavenue #{version}"
43
+ rdoc.rdoc_files.include('README*')
44
+ rdoc.rdoc_files.include('lib/**/*.rb')
45
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,61 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{active_merchant_ccavenue}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Suman Debnath"]
12
+ s.date = %q{2010-09-27}
13
+ s.description = %q{CCAvenue integration for ActiveMerchant}
14
+ s.email = %q{contact@meshbrain.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "active_merchant_ccavenue.gemspec",
27
+ "init.rb",
28
+ "lib/active_merchant_ccavenue.rb",
29
+ "lib/active_merchant_ccavenue/helper.rb",
30
+ "lib/active_merchant_ccavenue/notification.rb",
31
+ "spec/active_merchant_ccavenue_spec.rb",
32
+ "spec/spec.opts",
33
+ "spec/spec_helper.rb"
34
+ ]
35
+ s.homepage = %q{http://github.com/meshbrain/active_merchant_ccavenue}
36
+ s.rdoc_options = ["--charset=UTF-8"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = %q{1.3.7}
39
+ s.summary = %q{ActiveMerchantCCAvenue}
40
+ s.test_files = [
41
+ "spec/active_merchant_ccavenue_spec.rb",
42
+ "spec/spec_helper.rb"
43
+ ]
44
+
45
+ if s.respond_to? :specification_version then
46
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
+ s.specification_version = 3
48
+
49
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
51
+ s.add_runtime_dependency(%q<activemerchant>, [">= 1.7.3"])
52
+ else
53
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
54
+ s.add_dependency(%q<activemerchant>, [">= 1.7.3"])
55
+ end
56
+ else
57
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
58
+ s.add_dependency(%q<activemerchant>, [">= 1.7.3"])
59
+ end
60
+ end
61
+
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'active_merchant_ccavenue'
@@ -0,0 +1,28 @@
1
+ #require File.dirname(__FILE__) + '/active_merchant_ccavenue/helper.rb'
2
+ #require File.dirname(__FILE__) + '/active_merchant_ccavenue/notification.rb'
3
+
4
+ module ActiveMerchant #:nodoc:
5
+ module Billing #:nodoc:
6
+ module Integrations #:nodoc:
7
+ module Ccavenue
8
+ #autoload :Return, File.dirname(__FILE__) + '/active_merchant_ccavenue/return.rb'
9
+ autoload :Helper, File.dirname(__FILE__) + '/active_merchant_ccavenue/helper.rb'
10
+ autoload :Notification, File.dirname(__FILE__) + '/active_merchant_ccavenue/notification.rb'
11
+
12
+ mattr_accessor :merchant_id
13
+ mattr_accessor :work_key
14
+ mattr_accessor :service_url
15
+
16
+ self.service_url = 'https://www.ccavenue.com/shopzone/cc_details.jsp'
17
+
18
+ def self.setup
19
+ yield(self)
20
+ end
21
+
22
+ def self.notification(post)
23
+ Notification.new(post)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,34 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module Ccavenue
5
+ class Helper < ActiveMerchant::Billing::Integrations::Helper
6
+ mapping :amount, 'Amount'
7
+ mapping :order, 'Order_Id'
8
+ mapping :customer, :name => 'billing_cust_name',
9
+ :email => 'billing_cust_email',
10
+ :phone => 'billing_cust_tel'
11
+
12
+ def redirect(mapping = {})
13
+ add_field 'Redirect_Url', mapping[:return_url]
14
+ add_field 'Merchant_Id', ActiveMerchant::Billing::Integrations::Ccavenue.merchant_id
15
+ add_field 'Checksum', get_checksum(
16
+ ActiveMerchant::Billing::Integrations::Ccavenue.merchant_id,
17
+ self.fields[self.mappings[:order]],
18
+ self.fields[self.mappings[:amount]],
19
+ mapping[:return_url],
20
+ ActiveMerchant::Billing::Integrations::Ccavenue.work_key
21
+ )
22
+ end
23
+
24
+ private
25
+
26
+ def get_checksum(*args)
27
+ require 'zlib'
28
+ Zlib.adler32 args.join('|'), 1
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,52 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module Integrations #:nodoc:
4
+ module Ccavenue
5
+ class Notification < ActiveMerchant::Billing::Integrations::Notification
6
+ def valid?
7
+ verify_checksum(
8
+ self.security_key,
9
+ ActiveMerchant::Billing::Integrations::Ccavenue.merchant_id,
10
+ self.payment_id,
11
+ self.gross,
12
+ self.status,
13
+ ActiveMerchant::Billing::Integrations::Ccavenue.work_key
14
+ )
15
+ end
16
+
17
+ def complete?
18
+ 'Y' == self.status
19
+ end
20
+
21
+ def payment_id
22
+ params['Order_Id']
23
+ end
24
+
25
+ def transaction_id
26
+ params['nb_order_no']
27
+ end
28
+
29
+ def security_key
30
+ params['Checksum']
31
+ end
32
+
33
+ # the money amount we received in X.2 decimal.
34
+ def gross
35
+ params['Amount']
36
+ end
37
+
38
+ def status
39
+ params['AuthDesc']
40
+ end
41
+
42
+ private
43
+
44
+ def verify_checksum(checksum, *args)
45
+ require 'zlib'
46
+ Zlib.adler32(args.join('|'), 1).to_s.eql?(checksum)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "ActiveMerchantCcavenue" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'active_merchant_ccavenue'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_merchant_ccavenue
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Suman Debnath
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-27 00:00:00 +05:30
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 13
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 9
34
+ version: 1.2.9
35
+ type: :development
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: activemerchant
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 13
46
+ segments:
47
+ - 1
48
+ - 7
49
+ - 3
50
+ version: 1.7.3
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ description: CCAvenue integration for ActiveMerchant
54
+ email: contact@meshbrain.com
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files:
60
+ - LICENSE
61
+ - README.rdoc
62
+ files:
63
+ - .document
64
+ - .gitignore
65
+ - LICENSE
66
+ - README.rdoc
67
+ - Rakefile
68
+ - VERSION
69
+ - active_merchant_ccavenue.gemspec
70
+ - init.rb
71
+ - lib/active_merchant_ccavenue.rb
72
+ - lib/active_merchant_ccavenue/helper.rb
73
+ - lib/active_merchant_ccavenue/notification.rb
74
+ - spec/active_merchant_ccavenue_spec.rb
75
+ - spec/spec.opts
76
+ - spec/spec_helper.rb
77
+ has_rdoc: true
78
+ homepage: http://github.com/meshbrain/active_merchant_ccavenue
79
+ licenses: []
80
+
81
+ post_install_message:
82
+ rdoc_options:
83
+ - --charset=UTF-8
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 3
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ requirements: []
105
+
106
+ rubyforge_project:
107
+ rubygems_version: 1.3.7
108
+ signing_key:
109
+ specification_version: 3
110
+ summary: ActiveMerchantCCAvenue
111
+ test_files:
112
+ - spec/active_merchant_ccavenue_spec.rb
113
+ - spec/spec_helper.rb