active_merchant_ogone 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +63 -6
- data/VERSION.yml +4 -3
- data/active_merchant_ogone.gemspec +21 -29
- data/lib/active_merchant_ogone.rb +5 -4
- data/lib/active_merchant_ogone/helper.rb +32 -6
- data/test/active_merchant_ogone/helper_test.rb +41 -4
- data/test/active_merchant_ogone/notification_test.rb +3 -3
- data/test/test_helper.rb +37 -37
- metadata +31 -59
data/README.rdoc
CHANGED
@@ -30,7 +30,7 @@ As Ogone works with in and out signatures, you will have to set these as constan
|
|
30
30
|
c.inbound_signature = '094598439859385938958398494' # You can find this under "Data and origin verification" tab
|
31
31
|
end
|
32
32
|
|
33
|
-
Make sure that Ogone is set to "Each parameter followed by the pass phrase." as hashed value (under "Global security parameters").
|
33
|
+
Make sure that Ogone is set to "Each parameter followed by the pass phrase." as hashed value (under "Global security parameters").
|
34
34
|
If you don't see this setting, then you're probably already in that mode.
|
35
35
|
|
36
36
|
== Example Usage
|
@@ -41,12 +41,13 @@ Once you've configured the Ogone settings you need to set up a leaving page with
|
|
41
41
|
:amount => @order.price * 100 # needs to be in cents
|
42
42
|
:currency => 'EUR',
|
43
43
|
:service => :ogone do |service| %>
|
44
|
-
|
45
|
-
<% service.redirect :accepturl => checkout_url(@order),
|
44
|
+
<% service.redirect :accepturl => checkout_url(@order),
|
46
45
|
:cancelurl => checkout_url(@order),
|
47
46
|
:declineurl => checkout_url(@order),
|
48
47
|
:exceptionurl => checkout_url(@order) %>
|
49
|
-
|
48
|
+
|
49
|
+
<% service.language "nl_NL" %>
|
50
|
+
<% service.template "https://secure.ogone.com/ncol/template_standard.htm" %>
|
50
51
|
<%= submit_tag "Pay with Ogone!" %>
|
51
52
|
<% end %>
|
52
53
|
|
@@ -54,10 +55,10 @@ And in your controller you should have an enter path:
|
|
54
55
|
|
55
56
|
class CheckoutsController < ApplicationController
|
56
57
|
include ActiveMerchant::Billing::Integrations
|
57
|
-
|
58
|
+
|
58
59
|
def show
|
59
60
|
@notification = Ogone::Notification.new(request.query_string)
|
60
|
-
|
61
|
+
|
61
62
|
@order = Order.find_by_ogone_id(@notification.order_id)
|
62
63
|
if @notification.complete?
|
63
64
|
@order.paid!
|
@@ -67,4 +68,60 @@ And in your controller you should have an enter path:
|
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
71
|
+
== Example without setting the signatures in the config
|
72
|
+
|
73
|
+
If you need to use different signatures each time you can't set them on the
|
74
|
+
config. There's a way to set them just when you need them by doing the
|
75
|
+
following.
|
76
|
+
|
77
|
+
In your view:
|
78
|
+
|
79
|
+
<% payment_service_for @order.ogone_id, OGONE_ACCOUNT,
|
80
|
+
:amount => @order.price * 100 # needs to be in cents
|
81
|
+
:currency => 'EUR',
|
82
|
+
:credential2 => current_seller.outbound_signature,
|
83
|
+
:service => :ogone do |service| %>
|
84
|
+
|
85
|
+
<% service.redirect :accepturl => checkout_url(@order),
|
86
|
+
:cancelurl => checkout_url(@order),
|
87
|
+
:declineurl => checkout_url(@order),
|
88
|
+
:exceptionurl => checkout_url(@order) %>
|
89
|
+
|
90
|
+
<%= submit_tag "Pay with Ogone!" %>
|
91
|
+
<% end %>
|
92
|
+
|
93
|
+
On your controller:
|
94
|
+
|
95
|
+
class CheckoutsController < ApplicationController
|
96
|
+
include ActiveMerchant::Billing::Integrations
|
97
|
+
|
98
|
+
def show
|
99
|
+
@notification = Ogone::Notification.new request.query_string,
|
100
|
+
:signature => current_seller.inbound_signature
|
101
|
+
|
102
|
+
@order = Order.find_by_ogone_id(@notification.order_id)
|
103
|
+
if @notification.complete?
|
104
|
+
@order.paid!
|
105
|
+
else
|
106
|
+
@order.failed!
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
== AfterPay(NL) Usage
|
112
|
+
|
113
|
+
To use AfterPay in your forms:
|
114
|
+
|
115
|
+
<% service.after_pay :bill_first_name => "Nick",
|
116
|
+
:bill_last_name => "den Engelsman",
|
117
|
+
:bill_street_number => "1098",
|
118
|
+
:ship_first_name => "Nick",
|
119
|
+
:ship_last_name => "den Engelsman",
|
120
|
+
:ship_adress => "Laan van Meerdervoort",
|
121
|
+
:ship_adress_number => "1098",
|
122
|
+
:ship_adress_zip => "2564AZ",
|
123
|
+
:ship_adress_city => "Den Haag",
|
124
|
+
:ship_adress_country_code => "NL",
|
125
|
+
:ship_dob => "23/04/1987" %>
|
126
|
+
|
70
127
|
Copyright (c) 2009 Openminds BVBVA, released under the MIT license
|
data/VERSION.yml
CHANGED
@@ -1,49 +1,41 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.
|
7
|
+
s.name = "active_merchant_ogone"
|
8
|
+
s.version = "1.0.0"
|
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 =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2012-04-26"
|
13
|
+
s.description = "A plugin for Ogone support in ActiveRecord. "
|
14
|
+
s.email = "github@defv.be"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
"MIT-LICENSE",
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
"test/active_merchant_ogone/helper_test.rb",
|
29
|
-
"test/active_merchant_ogone/notification_test.rb",
|
30
|
-
"test/active_merchant_ogone_test.rb",
|
31
|
-
"test/test_helper.rb"
|
32
|
-
]
|
33
|
-
s.homepage = %q{http://github.com/DefV/active_merchant_ogone/tree/master}
|
34
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
35
|
-
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.3.7}
|
37
|
-
s.summary = %q{A plugin for Ogone support in ActiveRecord.}
|
38
|
-
s.test_files = [
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION.yml",
|
23
|
+
"active_merchant_ogone.gemspec",
|
24
|
+
"init.rb",
|
25
|
+
"lib/active_merchant_ogone.rb",
|
26
|
+
"lib/active_merchant_ogone/helper.rb",
|
27
|
+
"lib/active_merchant_ogone/notification.rb",
|
39
28
|
"test/active_merchant_ogone/helper_test.rb",
|
40
|
-
|
41
|
-
|
42
|
-
|
29
|
+
"test/active_merchant_ogone/notification_test.rb",
|
30
|
+
"test/active_merchant_ogone_test.rb",
|
31
|
+
"test/test_helper.rb"
|
43
32
|
]
|
33
|
+
s.homepage = "http://github.com/DefV/active_merchant_ogone/tree/master"
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = "1.8.17"
|
36
|
+
s.summary = "A plugin for Ogone support in ActiveRecord."
|
44
37
|
|
45
38
|
if s.respond_to? :specification_version then
|
46
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
39
|
s.specification_version = 3
|
48
40
|
|
49
41
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -9,7 +9,8 @@ module ActiveMerchant #:nodoc:
|
|
9
9
|
module Integrations #:nodoc:
|
10
10
|
module Ogone
|
11
11
|
|
12
|
-
INBOUND_ENCRYPTED_VARIABLES = %w(
|
12
|
+
INBOUND_ENCRYPTED_VARIABLES = %w(
|
13
|
+
AAVADDRESS AAVCHECK AAVZIP ACCEPTANCE ALIAS AMOUNT BRAND CARDNO CCCTY CN COMPLUS CREATION_STATUS CURRENCY CVCCHECK DCC_COMMPERCENTAGE DCC_CONVAMOUNT DCC_CONVCCY DCC_EXCHRATE DCC_EXCHRATESOURCE DCC_EXCHRATETS DCC_INDICATOR DCC_MARGINPERCENTAGE DCC_VALIDHOURS DIGESTCARDNO ECI ED ENCCARDNO IP IPCTY NBREMAILUSAGE NBRIPUSAGE NBRIPUSAGE_ALLTX NBRUSAGE NCERROR ORDERID PAYID PM SCO_CATEGORY SCORING SHA-OUT STATUS SUBSCRIPTION_ID TRXDATE VC )
|
13
14
|
|
14
15
|
mattr_accessor :inbound_signature
|
15
16
|
mattr_accessor :outbound_signature
|
@@ -17,8 +18,8 @@ module ActiveMerchant #:nodoc:
|
|
17
18
|
mattr_accessor :test_service_url
|
18
19
|
mattr_accessor :live_service_url
|
19
20
|
|
20
|
-
self.test_service_url = 'https://secure.ogone.com/ncol/test/
|
21
|
-
self.live_service_url = 'https://secure.ogone.com/ncol/prod/
|
21
|
+
self.test_service_url = 'https://secure.ogone.com/ncol/test/orderstandard_utf8.asp'
|
22
|
+
self.live_service_url = 'https://secure.ogone.com/ncol/prod/orderstandard_utf8.asp'
|
22
23
|
|
23
24
|
def self.setup
|
24
25
|
yield(self)
|
@@ -50,7 +51,7 @@ module ActiveMerchant #:nodoc:
|
|
50
51
|
def self.inbound_message_signature(fields, signature=nil)
|
51
52
|
signature ||= self.inbound_signature
|
52
53
|
datastring = fields.select {|k, v| !v.blank? && INBOUND_ENCRYPTED_VARIABLES.include?(k.upcase) }.
|
53
|
-
sort_by {|k, v| k.upcase }.
|
54
|
+
sort_by {|k, v| INBOUND_ENCRYPTED_VARIABLES.index(k.upcase) }.
|
54
55
|
collect {|key, value| "#{key.upcase}=#{value}#{signature}"}.join
|
55
56
|
|
56
57
|
Digest::SHA1.hexdigest(datastring).upcase
|
@@ -3,7 +3,13 @@ module ActiveMerchant #:nodoc:
|
|
3
3
|
module Integrations #:nodoc:
|
4
4
|
module Ogone
|
5
5
|
class Helper < ActiveMerchant::Billing::Integrations::Helper
|
6
|
-
|
6
|
+
attr_reader :outbound_signature
|
7
|
+
|
8
|
+
def initialize(order, account, options = {})
|
9
|
+
super
|
10
|
+
@outbound_signature = options[:credential2]
|
11
|
+
end
|
12
|
+
|
7
13
|
# required
|
8
14
|
mapping :order, 'orderID'
|
9
15
|
mapping :account, 'PSPID'
|
@@ -26,12 +32,32 @@ module ActiveMerchant #:nodoc:
|
|
26
32
|
:cancelurl => 'cancelurl',
|
27
33
|
:exceptionurl => 'exceptionurl'
|
28
34
|
|
35
|
+
mapping :language, 'language'
|
36
|
+
mapping :template, 'tp'
|
37
|
+
|
29
38
|
def customer(mapping = {})
|
30
39
|
add_field('ownertelno', mapping[:phone])
|
31
40
|
add_field('EMAIL', mapping[:email])
|
32
41
|
add_field('CN', "#{mapping[:first_name]} #{mapping[:last_name]}")
|
42
|
+
add_field('CIVILITY', mapping[:civility])
|
33
43
|
end
|
34
44
|
|
45
|
+
def after_pay(mapping = {})
|
46
|
+
# Billing adres
|
47
|
+
add_field('ECOM_BILLTO_POSTAL_NAME_FIRST', mapping[:bill_first_name])
|
48
|
+
add_field('ECOM_BILLTO_POSTAL_NAME_LAST', mapping[:bill_last_name])
|
49
|
+
add_field('ECOM_BILLTO_POSTAL_STREET_NUMBER', mapping[:bill_street_number])
|
50
|
+
# Shipping adres
|
51
|
+
add_field('ECOM_SHIPTO_POSTAL_NAME_FIRST', mapping[:ship_first_name])
|
52
|
+
add_field('ECOM_SHIPTO_POSTAL_NAME_LAST', mapping[:ship_last_name])
|
53
|
+
add_field('ECOM_SHIPTO_POSTAL_STREET_LINE1', mapping[:ship_adress])
|
54
|
+
add_field('ECOM_SHIPTO_POSTAL_STREET_NUMBER', mapping[:ship_adress_number])
|
55
|
+
add_field('ECOM_SHIPTO_POSTAL_POSTALCODE', mapping[:ship_adress_zip])
|
56
|
+
add_field('ECOM_SHIPTO_POSTAL_CITY', mapping[:ship_adress_city])
|
57
|
+
add_field('ECOM_SHIPTO_POSTAL_COUNTRYCODE', mapping[:ship_adress_country_code])
|
58
|
+
add_field('ECOM_SHIPTO_DOB', mapping[:ship_dob])
|
59
|
+
end
|
60
|
+
|
35
61
|
def operation operation
|
36
62
|
op = case operation
|
37
63
|
when :authorization, :auth; 'RES'
|
@@ -47,15 +73,15 @@ module ActiveMerchant #:nodoc:
|
|
47
73
|
add_field('SHASign', outbound_message_signature)
|
48
74
|
super
|
49
75
|
end
|
50
|
-
|
76
|
+
|
51
77
|
private
|
52
|
-
|
78
|
+
|
53
79
|
def outbound_message_signature
|
54
|
-
Ogone.outbound_message_signature(@fields)
|
80
|
+
Ogone.outbound_message_signature(@fields, self.outbound_signature)
|
55
81
|
end
|
56
|
-
|
82
|
+
|
57
83
|
end
|
58
84
|
end
|
59
85
|
end
|
60
86
|
end
|
61
|
-
end
|
87
|
+
end
|
@@ -4,7 +4,15 @@ class OgoneHelperTest < Test::Unit::TestCase
|
|
4
4
|
include ActiveMerchant::Billing::Integrations
|
5
5
|
|
6
6
|
def setup
|
7
|
-
@helper = Ogone::Helper.new
|
7
|
+
@helper = Ogone::Helper.new 'order-500','openminds', {
|
8
|
+
:amount => 900,
|
9
|
+
:currency => 'EUR',
|
10
|
+
:credential2 => '6df8766fb6d8275e0c0d'
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_outbound_signature
|
15
|
+
assert_equal '6df8766fb6d8275e0c0d', @helper.outbound_signature
|
8
16
|
end
|
9
17
|
|
10
18
|
def test_basic_helper_fields
|
@@ -16,18 +24,46 @@ class OgoneHelperTest < Test::Unit::TestCase
|
|
16
24
|
end
|
17
25
|
|
18
26
|
def test_customer_fields
|
19
|
-
@helper.customer :first_name => 'Jan', :last_name => 'De Poorter', :email => 'ogone@openminds.be'
|
27
|
+
@helper.customer :first_name => 'Jan', :last_name => 'De Poorter', :email => 'ogone@openminds.be', :civility => 'M'
|
20
28
|
assert_field 'CN', 'Jan De Poorter'
|
21
29
|
assert_field 'EMAIL', 'ogone@openminds.be'
|
30
|
+
assert_field 'CIVILITY', 'M'
|
22
31
|
end
|
23
32
|
|
33
|
+
def test_afterpay_fields
|
34
|
+
@helper.after_pay :bill_first_name => 'Nick',
|
35
|
+
:bill_last_name => 'den Engelsman',
|
36
|
+
:bill_street_number => '1098',
|
37
|
+
:ship_first_name => 'Nick',
|
38
|
+
:ship_last_name => 'den Engelsman',
|
39
|
+
:ship_adress => 'Laan van Meerdervoort',
|
40
|
+
:ship_adress_number => '1098',
|
41
|
+
:ship_adress_zip => '2564AZ',
|
42
|
+
:ship_adress_city => 'Den Haag',
|
43
|
+
:ship_adress_country_code => 'NL',
|
44
|
+
:ship_dob => '23/04/1987'
|
45
|
+
# Billing
|
46
|
+
assert_field 'ECOM_BILLTO_POSTAL_NAME_FIRST', 'Nick'
|
47
|
+
assert_field 'ECOM_BILLTO_POSTAL_NAME_LAST', 'den Engelsman'
|
48
|
+
assert_field 'ECOM_BILLTO_POSTAL_STREET_NUMBER', '1098'
|
49
|
+
# Shipping
|
50
|
+
assert_field 'ECOM_SHIPTO_POSTAL_NAME_FIRST', 'Nick'
|
51
|
+
assert_field 'ECOM_SHIPTO_POSTAL_NAME_LAST', 'den Engelsman'
|
52
|
+
assert_field 'ECOM_SHIPTO_POSTAL_STREET_LINE1', 'Laan van Meerdervoort'
|
53
|
+
assert_field 'ECOM_SHIPTO_POSTAL_STREET_NUMBER', '1098'
|
54
|
+
assert_field 'ECOM_SHIPTO_POSTAL_POSTALCODE', '2564AZ'
|
55
|
+
assert_field 'ECOM_SHIPTO_POSTAL_CITY', 'Den Haag'
|
56
|
+
assert_field 'ECOM_SHIPTO_POSTAL_COUNTRYCODE', 'NL'
|
57
|
+
assert_field 'ECOM_SHIPTO_DOB', '23/04/1987'
|
58
|
+
end
|
59
|
+
|
24
60
|
def test_operation
|
25
61
|
@helper.operation :payment
|
26
62
|
assert_field 'operation', 'SAL'
|
27
|
-
|
63
|
+
|
28
64
|
@helper.operation :auth
|
29
65
|
assert_field 'operation', 'RES'
|
30
|
-
|
66
|
+
|
31
67
|
@helper.operation 'SAL'
|
32
68
|
assert_field 'operation', 'SAL'
|
33
69
|
end
|
@@ -56,4 +92,5 @@ class OgoneHelperTest < Test::Unit::TestCase
|
|
56
92
|
@helper.billing_address :street => 'Zilverenberg'
|
57
93
|
assert_equal fields, @helper.fields
|
58
94
|
end
|
95
|
+
|
59
96
|
end
|
@@ -4,9 +4,9 @@ class OgoneNotificationTest < Test::Unit::TestCase
|
|
4
4
|
include ActiveMerchant::Billing::Integrations
|
5
5
|
|
6
6
|
Ogone.inbound_signature = '08445a31a78661b5c746feff39a9db6e4e2cc5cf'
|
7
|
-
|
7
|
+
|
8
8
|
SUCCESSFULL_HTTP_RAW_DATA = "orderID=order_342¤cy=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=0B5DB4D379C32331939DA40DCCA16B1556FB6256&IP=82.146.99.233"
|
9
|
-
|
9
|
+
|
10
10
|
FAULTY_HTTP_RAW_DATA = "orderID=order_342¤cy=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=0B5DB4D379C32331939DA40DCCA16B1556FB6256&IP=82.146.99.233"
|
11
11
|
|
12
12
|
def setup
|
@@ -34,5 +34,5 @@ class OgoneNotificationTest < Test::Unit::TestCase
|
|
34
34
|
Ogone::Notification.new(FAULTY_HTTP_RAW_DATA)
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
end
|
data/test/test_helper.rb
CHANGED
@@ -4,7 +4,7 @@ $:.unshift(File.dirname(__FILE__) + '/../lib')
|
|
4
4
|
require 'rubygems'
|
5
5
|
|
6
6
|
begin
|
7
|
-
gem 'actionpack', '2.3.
|
7
|
+
gem 'actionpack', '2.3.11'
|
8
8
|
rescue LoadError
|
9
9
|
raise StandardError, "The view tests need ActionPack installed as gem to run"
|
10
10
|
end
|
@@ -15,8 +15,8 @@ require 'test/unit'
|
|
15
15
|
require 'mocha'
|
16
16
|
require 'yaml'
|
17
17
|
|
18
|
-
require '
|
19
|
-
require '
|
18
|
+
#require 'action_dispatch'
|
19
|
+
#require 'action_dispatch/test_process'
|
20
20
|
require 'active_merchant/billing/integrations/action_view_helper'
|
21
21
|
|
22
22
|
require 'active_merchant_ogone'
|
@@ -34,65 +34,65 @@ end
|
|
34
34
|
module ActiveMerchant
|
35
35
|
module Assertions
|
36
36
|
def assert_field(field, value)
|
37
|
-
clean_backtrace do
|
37
|
+
clean_backtrace do
|
38
38
|
assert_equal value, @helper.fields[field]
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
42
|
-
# Allows the testing of you to check for negative assertions:
|
43
|
-
#
|
41
|
+
|
42
|
+
# Allows the testing of you to check for negative assertions:
|
43
|
+
#
|
44
44
|
# # Instead of
|
45
45
|
# assert !something_that_is_false
|
46
|
-
#
|
46
|
+
#
|
47
47
|
# # Do this
|
48
48
|
# assert_false something_that_should_be_false
|
49
|
-
#
|
49
|
+
#
|
50
50
|
# An optional +msg+ parameter is available to help you debug.
|
51
51
|
def assert_false(boolean, message = nil)
|
52
52
|
message = build_message message, '<?> is not false or nil.', boolean
|
53
|
-
|
53
|
+
|
54
54
|
clean_backtrace do
|
55
55
|
assert_block message do
|
56
56
|
not boolean
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
|
-
|
61
|
-
# A handy little assertion to check for a successful response:
|
62
|
-
#
|
60
|
+
|
61
|
+
# A handy little assertion to check for a successful response:
|
62
|
+
#
|
63
63
|
# # Instead of
|
64
64
|
# assert_success response
|
65
|
-
#
|
65
|
+
#
|
66
66
|
# # DRY that up with
|
67
67
|
# assert_success response
|
68
|
-
#
|
69
|
-
# A message will automatically show the inspection of the response
|
68
|
+
#
|
69
|
+
# A message will automatically show the inspection of the response
|
70
70
|
# object if things go afoul.
|
71
71
|
def assert_success(response)
|
72
72
|
clean_backtrace do
|
73
73
|
assert response.success?, "Response failed: #{response.inspect}"
|
74
74
|
end
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
# The negative of +assert_success+
|
78
78
|
def assert_failure(response)
|
79
79
|
clean_backtrace do
|
80
80
|
assert_false response.success?, "Response expected to fail: #{response.inspect}"
|
81
81
|
end
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
def assert_valid(validateable)
|
85
85
|
clean_backtrace do
|
86
86
|
assert validateable.valid?, "Expected to be valid"
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
def assert_not_valid(validateable)
|
91
91
|
clean_backtrace do
|
92
92
|
assert_false validateable.valid?, "Expected to not be valid"
|
93
93
|
end
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
private
|
97
97
|
def clean_backtrace(&block)
|
98
98
|
yield
|
@@ -101,12 +101,12 @@ module ActiveMerchant
|
|
101
101
|
raise Test::Unit::AssertionFailedError, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ }
|
102
102
|
end
|
103
103
|
end
|
104
|
-
|
104
|
+
|
105
105
|
module Fixtures
|
106
106
|
HOME_DIR = RUBY_PLATFORM =~ /mswin32/ ? ENV['HOMEPATH'] : ENV['HOME'] unless defined?(HOME_DIR)
|
107
107
|
LOCAL_CREDENTIALS = File.join(HOME_DIR.to_s, '.active_merchant/fixtures.yml') unless defined?(LOCAL_CREDENTIALS)
|
108
108
|
DEFAULT_CREDENTIALS = File.join(File.dirname(__FILE__), 'fixtures.yml') unless defined?(DEFAULT_CREDENTIALS)
|
109
|
-
|
109
|
+
|
110
110
|
private
|
111
111
|
def credit_card(number = '4242424242424242', options = {})
|
112
112
|
defaults = {
|
@@ -121,22 +121,22 @@ module ActiveMerchant
|
|
121
121
|
|
122
122
|
Billing::CreditCard.new(defaults)
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
def check(options = {})
|
126
126
|
defaults = {
|
127
127
|
:name => 'Jim Smith',
|
128
|
-
:routing_number => '244183602',
|
129
|
-
:account_number => '15378535',
|
130
|
-
:account_holder_type => 'personal',
|
131
|
-
:account_type => 'checking',
|
128
|
+
:routing_number => '244183602',
|
129
|
+
:account_number => '15378535',
|
130
|
+
:account_holder_type => 'personal',
|
131
|
+
:account_type => 'checking',
|
132
132
|
:number => '1'
|
133
133
|
}.update(options)
|
134
|
-
|
134
|
+
|
135
135
|
Billing::Check.new(defaults)
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
def address(options = {})
|
139
|
-
{
|
139
|
+
{
|
140
140
|
:name => 'Jim Smith',
|
141
141
|
:address1 => '1234 My Street',
|
142
142
|
:address2 => 'Apt 1',
|
@@ -149,28 +149,28 @@ module ActiveMerchant
|
|
149
149
|
:fax => '(555)555-6666'
|
150
150
|
}.update(options)
|
151
151
|
end
|
152
|
-
|
152
|
+
|
153
153
|
def all_fixtures
|
154
154
|
@@fixtures ||= load_fixtures
|
155
155
|
end
|
156
|
-
|
156
|
+
|
157
157
|
def fixtures(key)
|
158
158
|
data = all_fixtures[key] || raise(StandardError, "No fixture data was found for '#{key}'")
|
159
|
-
|
159
|
+
|
160
160
|
data.dup
|
161
161
|
end
|
162
|
-
|
162
|
+
|
163
163
|
def load_fixtures
|
164
164
|
file = File.exists?(LOCAL_CREDENTIALS) ? LOCAL_CREDENTIALS : DEFAULT_CREDENTIALS
|
165
165
|
yaml_data = YAML.load(File.read(file))
|
166
166
|
symbolize_keys(yaml_data)
|
167
|
-
|
167
|
+
|
168
168
|
yaml_data
|
169
169
|
end
|
170
|
-
|
170
|
+
|
171
171
|
def symbolize_keys(hash)
|
172
172
|
return unless hash.is_a?(Hash)
|
173
|
-
|
173
|
+
|
174
174
|
hash.symbolize_keys!
|
175
175
|
hash.each{|k,v| symbolize_keys(v)}
|
176
176
|
end
|
metadata
CHANGED
@@ -1,49 +1,35 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_merchant_ogone
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 0.2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Jan De Poorter
|
14
9
|
- Simon Menke
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-04-26 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
23
16
|
name: activemerchant
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70286214577460 !ruby/object:Gem::Requirement
|
26
18
|
none: false
|
27
|
-
requirements:
|
28
|
-
- -
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 3
|
31
|
-
segments:
|
32
|
-
- 1
|
33
|
-
- 4
|
34
|
-
- 2
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
35
22
|
version: 1.4.2
|
36
23
|
type: :runtime
|
37
|
-
|
38
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70286214577460
|
26
|
+
description: ! 'A plugin for Ogone support in ActiveRecord. '
|
39
27
|
email: github@defv.be
|
40
28
|
executables: []
|
41
|
-
|
42
29
|
extensions: []
|
43
|
-
|
44
|
-
extra_rdoc_files:
|
30
|
+
extra_rdoc_files:
|
45
31
|
- README.rdoc
|
46
|
-
files:
|
32
|
+
files:
|
47
33
|
- MIT-LICENSE
|
48
34
|
- README.rdoc
|
49
35
|
- Rakefile
|
@@ -57,42 +43,28 @@ files:
|
|
57
43
|
- test/active_merchant_ogone/notification_test.rb
|
58
44
|
- test/active_merchant_ogone_test.rb
|
59
45
|
- test/test_helper.rb
|
60
|
-
has_rdoc: true
|
61
46
|
homepage: http://github.com/DefV/active_merchant_ogone/tree/master
|
62
47
|
licenses: []
|
63
|
-
|
64
48
|
post_install_message:
|
65
|
-
rdoc_options:
|
66
|
-
|
67
|
-
require_paths:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
68
51
|
- lib
|
69
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
53
|
none: false
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
|
76
|
-
- 0
|
77
|
-
version: "0"
|
78
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
59
|
none: false
|
80
|
-
requirements:
|
81
|
-
- -
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
|
84
|
-
segments:
|
85
|
-
- 0
|
86
|
-
version: "0"
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
87
64
|
requirements: []
|
88
|
-
|
89
65
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.
|
66
|
+
rubygems_version: 1.8.17
|
91
67
|
signing_key:
|
92
68
|
specification_version: 3
|
93
69
|
summary: A plugin for Ogone support in ActiveRecord.
|
94
|
-
test_files:
|
95
|
-
- test/active_merchant_ogone/helper_test.rb
|
96
|
-
- test/active_merchant_ogone/notification_test.rb
|
97
|
-
- test/active_merchant_ogone_test.rb
|
98
|
-
- test/test_helper.rb
|
70
|
+
test_files: []
|