simonmenke-active_merchant_ogone 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -31,8 +31,8 @@ begin
31
31
  gemspec.email = "github@defv.be"
32
32
  gemspec.homepage = "http://github.com/DefV/active_merchant_ogone/tree/master"
33
33
  gemspec.authors = ["Jan De Poorter", "Simon Menke"]
34
- gemspec.add_dependency 'activemerchant', '>= 0'
34
+ gemspec.add_dependency 'activemerchant', '>= 1.4.2'
35
35
  end
36
36
  rescue LoadError
37
37
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
38
- end
38
+ end
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 2
3
3
  :major: 0
4
4
  :minor: 1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{active_merchant_ogone}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jan De Poorter", "Simon Menke"]
12
- s.date = %q{2009-09-01}
12
+ s.date = %q{2009-09-03}
13
13
  s.description = %q{A plugin for Ogone support in ActiveRecord. }
14
14
  s.email = %q{github@defv.be}
15
15
  s.extra_rdoc_files = [
@@ -47,11 +47,11 @@ Gem::Specification.new do |s|
47
47
  s.specification_version = 3
48
48
 
49
49
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
- s.add_runtime_dependency(%q<activemerchant>, [">= 0"])
50
+ s.add_runtime_dependency(%q<activemerchant>, [">= 1.4.2"])
51
51
  else
52
- s.add_dependency(%q<activemerchant>, [">= 0"])
52
+ s.add_dependency(%q<activemerchant>, [">= 1.4.2"])
53
53
  end
54
54
  else
55
- s.add_dependency(%q<activemerchant>, [">= 0"])
55
+ s.add_dependency(%q<activemerchant>, [">= 1.4.2"])
56
56
  end
57
57
  end
@@ -8,13 +8,19 @@ module ActiveMerchant #:nodoc:
8
8
  module Billing #:nodoc:
9
9
  module Integrations #:nodoc:
10
10
  module Ogone
11
-
11
+
12
+ mattr_accessor :inbound_signature
13
+ mattr_accessor :outbound_signature
14
+
12
15
  mattr_accessor :test_service_url
13
16
  mattr_accessor :live_service_url
14
17
 
15
18
  self.test_service_url = 'https://secure.ogone.com/ncol/test/orderstandard.asp'
16
19
  self.live_service_url = 'https://secure.ogone.com/ncol/prod/orderstandard.asp'
17
20
 
21
+ def self.setup
22
+ yield(self)
23
+ end
18
24
 
19
25
  def self.service_url
20
26
  mode = ActiveMerchant::Billing::Base.integration_mode
@@ -30,14 +36,16 @@ module ActiveMerchant #:nodoc:
30
36
  Notification.new(post, options={})
31
37
  end
32
38
 
33
- def self.outbound_message_signature(fields, signature)
39
+ def self.outbound_message_signature(fields, signature=nil)
40
+ signature ||= self.outbound_signature
34
41
  keys = %w( orderID amount currency PSPID )
35
42
  datastring = keys.inject('') { |m,key| m.concat(fields[key].to_s) ; m }
36
43
  datastring.concat(signature)
37
44
  Digest::SHA1.hexdigest(datastring).upcase
38
45
  end
39
46
 
40
- def self.inbound_message_signature(fields, signature)
47
+ def self.inbound_message_signature(fields, signature=nil)
48
+ signature ||= self.inbound_signature
41
49
  keys = %w( orderID currency amount PM ACCEPTANCE STATUS CARDNO PAYID NCERROR BRAND )
42
50
  datastring = keys.inject('') { |m,key| m.concat(fields[key].to_s) ; m }
43
51
  datastring.concat(signature)
@@ -41,7 +41,7 @@ module ActiveMerchant #:nodoc:
41
41
  private
42
42
 
43
43
  def outbound_message_signature
44
- Ogone.outbound_message_signature(@fields, OGONE_SHA1_SIGNATURE_OUT)
44
+ Ogone.outbound_message_signature(@fields)
45
45
  end
46
46
 
47
47
  end
@@ -3,15 +3,14 @@ require 'test_helper'
3
3
  class OgoneNotificationTest < Test::Unit::TestCase
4
4
  include ActiveMerchant::Billing::Integrations
5
5
 
6
- OGONE_SHA1_SIGNATURE_IN = '08445a31a78661b5c746feff39a9db6e4e2cc5cf'
6
+ Ogone.inbound_signature = '08445a31a78661b5c746feff39a9db6e4e2cc5cf'
7
7
 
8
8
  SUCCESSFULL_HTTP_RAW_DATA = "orderID=order_342&currency=EUR&amount=50&PM=CreditCard&ACCEPTANCE=test123&STATUS=9&CARDNO=XXXXXXXXXXXX1111&PAYID=2396925&NCERROR=0&BRAND=VISA&IPCTY=BE&CCCTY=US&ECI=7&CVCCheck=NO&AAVCheck=NO&VC=NO&SHASIGN=FE220C6F4492165533488E35F47F231D6BC357FC&IP=82.146.99.233"
9
9
 
10
10
  FAULTY_HTTP_RAW_DATA = "orderID=order_342&currency=EUR&amount=50&PM=CreditCard&ACCEPTANCE=test123&STATUS=abc&CARDNO=XXXXXXXXXXXX1111&PAYID=2396925&NCERROR=0&BRAND=VISA&IPCTY=BE&CCCTY=US&ECI=7&CVCCheck=NO&AAVCheck=NO&VC=NO&SHASIGN=FE220C6F4492165533488E35F47F231D6BC357FC&IP=82.146.99.233"
11
11
 
12
12
  def setup
13
- @ogone = Ogone::Notification.new(SUCCESSFULL_HTTP_RAW_DATA,
14
- :signature => OGONE_SHA1_SIGNATURE_IN)
13
+ @ogone = Ogone::Notification.new(SUCCESSFULL_HTTP_RAW_DATA)
15
14
  end
16
15
 
17
16
  def test_accessors
@@ -32,8 +31,7 @@ class OgoneNotificationTest < Test::Unit::TestCase
32
31
 
33
32
  def test_invalid_status_should_raise_an_error
34
33
  assert_raise(ActiveMerchant::OgoneError) do
35
- Ogone::Notification.new(FAULTY_HTTP_RAW_DATA,
36
- :signature => OGONE_SHA1_SIGNATURE_IN)
34
+ Ogone::Notification.new(FAULTY_HTTP_RAW_DATA)
37
35
  end
38
36
  end
39
37
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simonmenke-active_merchant_ogone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan De Poorter
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-01 00:00:00 -07:00
13
+ date: 2009-09-03 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: "0"
24
+ version: 1.4.2
25
25
  version:
26
26
  description: A plugin for Ogone support in ActiveRecord.
27
27
  email: github@defv.be
@@ -47,6 +47,7 @@ files:
47
47
  - test/test_helper.rb
48
48
  has_rdoc: false
49
49
  homepage: http://github.com/DefV/active_merchant_ogone/tree/master
50
+ licenses:
50
51
  post_install_message:
51
52
  rdoc_options:
52
53
  - --charset=UTF-8
@@ -67,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
68
  requirements: []
68
69
 
69
70
  rubyforge_project:
70
- rubygems_version: 1.2.0
71
+ rubygems_version: 1.3.5
71
72
  signing_key:
72
73
  specification_version: 3
73
74
  summary: A plugin for Ogone support in ActiveRecord.