activemerchant_moneybookers 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +30 -0
- data/Rakefile +26 -0
- data/activemerchant_moneybookers.gemspec +23 -0
- data/init.rb +1 -0
- data/lib/active_merchant/billing/gateways/moneybookers.rb +154 -0
- data/lib/activemerchant_moneybookers.rb +3 -0
- data/lib/activemerchant_moneybookers/version.rb +3 -0
- data/test/test_helper.rb +197 -0
- data/test/unit/gateways/moneybookers_test.rb +305 -0
- metadata +95 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2005-2010 Tobias Luetke
|
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.
|
data/README.rdoc
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
= Active Merchant Moneybookers
|
2
|
+
|
3
|
+
This library adds {Moneybookers}[http://moneybookers.com] payment gateway support to {ActiveMerchant}[http://activemerchant.org].
|
4
|
+
|
5
|
+
Gem is originally based on ActiveMerchant {patch}[https://github.com/Shopify/active_merchant/issues#issue/31] by Jan Riethmayer.
|
6
|
+
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
=== From Ruby Gems
|
10
|
+
|
11
|
+
Installation from RubyGems
|
12
|
+
|
13
|
+
> gem install activemerchant_moneybookers
|
14
|
+
|
15
|
+
=== From Git
|
16
|
+
|
17
|
+
You can check out the latest source from git:
|
18
|
+
|
19
|
+
> git pull git://github.com/laurynas/activemerchant_moneybookers.git
|
20
|
+
|
21
|
+
== Testing
|
22
|
+
|
23
|
+
You can run the tests from this gem with (inside the activemerchant_moneybookers directory):
|
24
|
+
|
25
|
+
> rake test
|
26
|
+
|
27
|
+
== Maintainer
|
28
|
+
|
29
|
+
This gem is maintained by {Laurynas Butkus}[mailto:laurynas.butkus@gmail.com]
|
30
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
desc "Run the unit test suite"
|
7
|
+
task :default => 'test:units'
|
8
|
+
|
9
|
+
namespace :test do
|
10
|
+
|
11
|
+
Rake::TestTask.new(:units) do |t|
|
12
|
+
t.pattern = 'test/unit/**/*_test.rb'
|
13
|
+
t.ruby_opts << '-rubygems'
|
14
|
+
t.libs << 'test'
|
15
|
+
t.verbose = true
|
16
|
+
end
|
17
|
+
|
18
|
+
Rake::TestTask.new(:remote) do |t|
|
19
|
+
t.pattern = 'test/remote/**/*_test.rb'
|
20
|
+
t.ruby_opts << '-rubygems'
|
21
|
+
t.libs << 'test'
|
22
|
+
t.verbose = true
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "activemerchant_moneybookers/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "activemerchant_moneybookers"
|
7
|
+
s.version = ActivemerchantMoneybookers::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Jan Riethmayer", "Laurynas Butkus"]
|
10
|
+
s.email = ["laurynas.butkus@gmail.com"]
|
11
|
+
s.homepage = "http://rubygems.org/gems/activemerchant_moneybookers"
|
12
|
+
s.summary = %q{ActiveMerchant Moneybookers gateway}
|
13
|
+
s.description = %q{Adds Moneybookers payment gateway support to ActiveMerchant library}
|
14
|
+
|
15
|
+
s.rubyforge_project = "activemerchant_moneybookers"
|
16
|
+
|
17
|
+
s.add_dependency 'activemerchant', '>= 1.7.1'
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
end
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'activemerchant_moneybookers'
|
@@ -0,0 +1,154 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class MoneybookersResponse
|
4
|
+
def initialize response_body
|
5
|
+
@response = response_body
|
6
|
+
end
|
7
|
+
|
8
|
+
def token
|
9
|
+
return result = if(success?)
|
10
|
+
@response
|
11
|
+
else
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def success?
|
17
|
+
@response =~ /^\w{32}$/
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class MoneybookersGateway < Gateway
|
22
|
+
PAYMENT_URL = 'https://www.moneybookers.com/app/payment.pl'
|
23
|
+
|
24
|
+
# Moneybookers API version
|
25
|
+
# September 03, 2009
|
26
|
+
API_VERSION = "6.8"
|
27
|
+
|
28
|
+
class << self
|
29
|
+
# TODO check additional supported countries
|
30
|
+
# supported_countries = ['DE']
|
31
|
+
# TODO check additional supported card types
|
32
|
+
# supported_cardtypes = [:visa, :master, :american_express]
|
33
|
+
homepage_url = PAYMENT_URL
|
34
|
+
test_redirect_url = PAYMENT_URL
|
35
|
+
money_format = :cents # 100 is 1.00 Euro
|
36
|
+
default_currency = 'EUR'
|
37
|
+
display_name = 'Moneybookers Payment Gateway'
|
38
|
+
end
|
39
|
+
|
40
|
+
def initialize(options = {})
|
41
|
+
requires!(options,
|
42
|
+
:pay_to_email, # merchant email
|
43
|
+
:return_url, # after client purchases
|
44
|
+
:cancel_url, # after client cancels
|
45
|
+
:language, # displayed mb page language
|
46
|
+
# notification from mb after successful payment
|
47
|
+
# may also be an email, but you may use
|
48
|
+
# :notify_email additionally for that
|
49
|
+
:notify_url,
|
50
|
+
# details show up in clients payments history
|
51
|
+
:detail1_description, # e.g. "Product ID:"
|
52
|
+
:detail1_text
|
53
|
+
)
|
54
|
+
@options = options
|
55
|
+
super
|
56
|
+
end
|
57
|
+
|
58
|
+
def setup_purchase(amount)
|
59
|
+
data = post_data(amount,{:prepare_only => "1"})
|
60
|
+
@response = MoneybookersResponse.new(ssl_post(PAYMENT_URL, data))
|
61
|
+
end
|
62
|
+
|
63
|
+
def checkout_url
|
64
|
+
@response.success? && redirect_url || nil
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
def redirect_url
|
69
|
+
"#{PAYMENT_URL}?sid=#{@response.token}"
|
70
|
+
end
|
71
|
+
|
72
|
+
def currency
|
73
|
+
@options[:currency] || "EUR"
|
74
|
+
end
|
75
|
+
|
76
|
+
def post_data(amount_in_cents, parameters = {})
|
77
|
+
post = {}
|
78
|
+
# mandatory fields
|
79
|
+
post[:pay_to_email] = @options[:pay_to_email]
|
80
|
+
post[:return_url] = @options[:return_url]
|
81
|
+
post[:return_url_text] = @options[:return_url_text]
|
82
|
+
post[:cancel_url] = @options[:cancel_url]
|
83
|
+
post[:detail1_description] = @options[:detail1_description]
|
84
|
+
post[:detail1_text] = @options[:detail1_text]
|
85
|
+
post[:amount] = amount(amount_in_cents)
|
86
|
+
post[:language] = @options[:language]
|
87
|
+
post[:status_url] = @options[:notify_url] || @options[:status_url]
|
88
|
+
post[:status_url2] = @options[:notify_email] || @options[:status_url2]
|
89
|
+
post[:currency] = currency
|
90
|
+
|
91
|
+
# billing_address
|
92
|
+
if @options[:billing_address]
|
93
|
+
post[:pay_from_email] = @options[:email]
|
94
|
+
post[:title] = @options[:billing_address][:title]
|
95
|
+
post[:firstname] = @options[:billing_address][:firstname]
|
96
|
+
post[:lastname] = @options[:billing_address][:lastname]
|
97
|
+
post[:date_of_birth] = @options[:billing_address][:date_of_birth]
|
98
|
+
post[:address] = @options[:billing_address][:address]
|
99
|
+
post[:address2] = @options[:billing_address][:address2]
|
100
|
+
post[:phone_number] = @options[:billing_address][:phone_number]
|
101
|
+
post[:postal_code] = @options[:billing_address][:postal_code]
|
102
|
+
post[:city] = @options[:billing_address][:city]
|
103
|
+
post[:state] = @options[:billing_address][:state]
|
104
|
+
post[:country] = @options[:billing_address][:country]
|
105
|
+
end
|
106
|
+
|
107
|
+
# Merchant may specify a detailed calculation for the total
|
108
|
+
# amount payable. Please note that moneybookers does not check
|
109
|
+
# the validity of these data - they are only displayed in the
|
110
|
+
# details section of Step 2 of the payment process.
|
111
|
+
[:amount2_description, # e.g. "Product Price:"
|
112
|
+
:amount2, # e.g. "29.90"
|
113
|
+
:amount3_description, # e.g. "Handling Fees:"
|
114
|
+
:amount3, # e.g. "3.10"
|
115
|
+
:amount4_description, # e.g. "VAT (20%):"
|
116
|
+
:amount4, # e.g. "6.60"
|
117
|
+
|
118
|
+
# customer
|
119
|
+
:dynamic_descriptor, # merchant name
|
120
|
+
:confirmation_note, # thank you note
|
121
|
+
:merchant_fields, # fields which will be sent back to you
|
122
|
+
|
123
|
+
# product details (up to 5 fields)
|
124
|
+
# Merchant may show up to 5 details about the product or
|
125
|
+
# transfer in the 'Payment Details' section of Step 2 of the
|
126
|
+
# process. The detail1_descritpion is shown on the left side.
|
127
|
+
:detail2_description,
|
128
|
+
:detail2_text,
|
129
|
+
:detail3_description,
|
130
|
+
:detail3_text,
|
131
|
+
:detail4_description,
|
132
|
+
:detail4_text,
|
133
|
+
:detail5_description,
|
134
|
+
:detail5_text,
|
135
|
+
|
136
|
+
# recurring billing
|
137
|
+
:rec_period,
|
138
|
+
:rec_grace_period,
|
139
|
+
:rec_cycle,
|
140
|
+
:ondemand_max_currency
|
141
|
+
].each do |f|
|
142
|
+
post[f] = @options[f] if @options[f]
|
143
|
+
end
|
144
|
+
|
145
|
+
request = post.merge(parameters).collect do |key, value|
|
146
|
+
"#{key}=#{CGI.escape(value.to_s)}"
|
147
|
+
end.join("&")
|
148
|
+
|
149
|
+
request
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'test/unit'
|
6
|
+
require 'money'
|
7
|
+
require 'mocha'
|
8
|
+
require 'yaml'
|
9
|
+
require 'activemerchant_moneybookers'
|
10
|
+
|
11
|
+
require 'active_support/core_ext/integer/time'
|
12
|
+
require 'active_support/core_ext/numeric/time'
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'active_support/core_ext/time/acts_like'
|
16
|
+
rescue LoadError
|
17
|
+
end
|
18
|
+
|
19
|
+
begin
|
20
|
+
gem 'actionpack'
|
21
|
+
rescue LoadError
|
22
|
+
raise StandardError, "The view tests need ActionPack installed as gem to run"
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'action_controller'
|
26
|
+
require "action_view/template"
|
27
|
+
begin
|
28
|
+
require 'action_dispatch/testing/test_process'
|
29
|
+
rescue LoadError
|
30
|
+
require 'action_controller/test_process'
|
31
|
+
end
|
32
|
+
require 'active_merchant/billing/integrations/action_view_helper'
|
33
|
+
|
34
|
+
ActiveMerchant::Billing::Base.mode = :test
|
35
|
+
|
36
|
+
# Test gateways
|
37
|
+
class SimpleTestGateway < ActiveMerchant::Billing::Gateway
|
38
|
+
end
|
39
|
+
|
40
|
+
class SubclassGateway < SimpleTestGateway
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
module ActiveMerchant
|
45
|
+
module Assertions
|
46
|
+
AssertionClass = RUBY_VERSION > '1.9' ? MiniTest::Assertion : Test::Unit::AssertionFailedError
|
47
|
+
|
48
|
+
def assert_field(field, value)
|
49
|
+
clean_backtrace do
|
50
|
+
assert_equal value, @helper.fields[field]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Allows the testing of you to check for negative assertions:
|
55
|
+
#
|
56
|
+
# # Instead of
|
57
|
+
# assert !something_that_is_false
|
58
|
+
#
|
59
|
+
# # Do this
|
60
|
+
# assert_false something_that_should_be_false
|
61
|
+
#
|
62
|
+
# An optional +msg+ parameter is available to help you debug.
|
63
|
+
def assert_false(boolean, message = nil)
|
64
|
+
message = build_message message, '<?> is not false or nil.', boolean
|
65
|
+
|
66
|
+
clean_backtrace do
|
67
|
+
assert_block message do
|
68
|
+
not boolean
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# A handy little assertion to check for a successful response:
|
74
|
+
#
|
75
|
+
# # Instead of
|
76
|
+
# assert_success response
|
77
|
+
#
|
78
|
+
# # DRY that up with
|
79
|
+
# assert_success response
|
80
|
+
#
|
81
|
+
# A message will automatically show the inspection of the response
|
82
|
+
# object if things go afoul.
|
83
|
+
def assert_success(response)
|
84
|
+
clean_backtrace do
|
85
|
+
assert response.success?, "Response failed: #{response.inspect}"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# The negative of +assert_success+
|
90
|
+
def assert_failure(response)
|
91
|
+
clean_backtrace do
|
92
|
+
assert_false response.success?, "Response expected to fail: #{response.inspect}"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def assert_valid(validateable)
|
97
|
+
clean_backtrace do
|
98
|
+
assert validateable.valid?, "Expected to be valid"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def assert_not_valid(validateable)
|
103
|
+
clean_backtrace do
|
104
|
+
assert_false validateable.valid?, "Expected to not be valid"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
def clean_backtrace(&block)
|
110
|
+
yield
|
111
|
+
rescue AssertionClass => e
|
112
|
+
path = File.expand_path(__FILE__)
|
113
|
+
raise AssertionClass, e.message, e.backtrace.reject { |line| File.expand_path(line) =~ /#{path}/ }
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
module Fixtures
|
118
|
+
HOME_DIR = RUBY_PLATFORM =~ /mswin32/ ? ENV['HOMEPATH'] : ENV['HOME'] unless defined?(HOME_DIR)
|
119
|
+
LOCAL_CREDENTIALS = File.join(HOME_DIR.to_s, '.active_merchant/fixtures.yml') unless defined?(LOCAL_CREDENTIALS)
|
120
|
+
DEFAULT_CREDENTIALS = File.join(File.dirname(__FILE__), 'fixtures.yml') unless defined?(DEFAULT_CREDENTIALS)
|
121
|
+
|
122
|
+
private
|
123
|
+
def credit_card(number = '4242424242424242', options = {})
|
124
|
+
defaults = {
|
125
|
+
:number => number,
|
126
|
+
:month => 9,
|
127
|
+
:year => Time.now.year + 1,
|
128
|
+
:first_name => 'Longbob',
|
129
|
+
:last_name => 'Longsen',
|
130
|
+
:verification_value => '123',
|
131
|
+
:type => 'visa'
|
132
|
+
}.update(options)
|
133
|
+
|
134
|
+
Billing::CreditCard.new(defaults)
|
135
|
+
end
|
136
|
+
|
137
|
+
def check(options = {})
|
138
|
+
defaults = {
|
139
|
+
:name => 'Jim Smith',
|
140
|
+
:routing_number => '244183602',
|
141
|
+
:account_number => '15378535',
|
142
|
+
:account_holder_type => 'personal',
|
143
|
+
:account_type => 'checking',
|
144
|
+
:number => '1'
|
145
|
+
}.update(options)
|
146
|
+
|
147
|
+
Billing::Check.new(defaults)
|
148
|
+
end
|
149
|
+
|
150
|
+
def address(options = {})
|
151
|
+
{
|
152
|
+
:name => 'Jim Smith',
|
153
|
+
:address1 => '1234 My Street',
|
154
|
+
:address2 => 'Apt 1',
|
155
|
+
:company => 'Widgets Inc',
|
156
|
+
:city => 'Ottawa',
|
157
|
+
:state => 'ON',
|
158
|
+
:zip => 'K1C2N6',
|
159
|
+
:country => 'CA',
|
160
|
+
:phone => '(555)555-5555',
|
161
|
+
:fax => '(555)555-6666'
|
162
|
+
}.update(options)
|
163
|
+
end
|
164
|
+
|
165
|
+
def all_fixtures
|
166
|
+
@@fixtures ||= load_fixtures
|
167
|
+
end
|
168
|
+
|
169
|
+
def fixtures(key)
|
170
|
+
data = all_fixtures[key] || raise(StandardError, "No fixture data was found for '#{key}'")
|
171
|
+
|
172
|
+
data.dup
|
173
|
+
end
|
174
|
+
|
175
|
+
def load_fixtures
|
176
|
+
file = File.exists?(LOCAL_CREDENTIALS) ? LOCAL_CREDENTIALS : DEFAULT_CREDENTIALS
|
177
|
+
yaml_data = YAML.load(File.read(file))
|
178
|
+
symbolize_keys(yaml_data)
|
179
|
+
|
180
|
+
yaml_data
|
181
|
+
end
|
182
|
+
|
183
|
+
def symbolize_keys(hash)
|
184
|
+
return unless hash.is_a?(Hash)
|
185
|
+
|
186
|
+
hash.symbolize_keys!
|
187
|
+
hash.each{|k,v| symbolize_keys(v)}
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
Test::Unit::TestCase.class_eval do
|
193
|
+
include ActiveMerchant::Billing
|
194
|
+
include ActiveMerchant::Assertions
|
195
|
+
include ActiveMerchant::Utils
|
196
|
+
include ActiveMerchant::Fixtures
|
197
|
+
end
|
@@ -0,0 +1,305 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
3
|
+
class MoneybookersTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@amount = 100
|
6
|
+
@options = {
|
7
|
+
:pay_to_email => 'seller_test@urbanvention.com',
|
8
|
+
:billing_address => address,
|
9
|
+
:return_url => 'localhost:3000/payment_confirmed',
|
10
|
+
:cancel_url => 'localhost:3000/payment_canceled',
|
11
|
+
:language => "DE",
|
12
|
+
:notify_url => 'localhost:3000/notify_payment_success',
|
13
|
+
:detail1_description => "Bestellnummer: ",
|
14
|
+
:detail1_text => "FooBar123"
|
15
|
+
}
|
16
|
+
@gateway = MoneybookersGateway.new(@options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_currency_defaults_to_euro
|
20
|
+
assert_equal "EUR", @gateway.instance_eval {currency}
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_billing_address_present
|
24
|
+
assert @options[:billing_address]
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_successful_purchase_setup
|
28
|
+
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
29
|
+
assert response = @gateway.setup_purchase(@amount)
|
30
|
+
assert response.success?
|
31
|
+
assert response.token =~ /\w{32}/
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_amount_method
|
35
|
+
cents = 1000
|
36
|
+
assert_equal "10.00", @gateway.instance_eval {amount(cents)}
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_successful_purchase_setup_provides_checkout_url
|
40
|
+
@gateway.expects(:ssl_post).returns(successful_purchase_response)
|
41
|
+
assert response = @gateway.setup_purchase(@amount)
|
42
|
+
assert_false @gateway.checkout_url.nil?
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_unsuccessful_request
|
46
|
+
@gateway.expects(:ssl_post).returns(failed_purchase_response)
|
47
|
+
assert response = @gateway.setup_purchase(@amount)
|
48
|
+
assert_failure response
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def successful_purchase_response
|
54
|
+
"b30507717219e01892e5c238c559a7f7"
|
55
|
+
end
|
56
|
+
|
57
|
+
# Place raw failed response from gateway here
|
58
|
+
# this one happens with a wrong currency
|
59
|
+
def failed_purchase_response
|
60
|
+
<<-RESPONSE
|
61
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
62
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
63
|
+
<head>
|
64
|
+
|
65
|
+
<script type="text/javascript">
|
66
|
+
function LoaderDispatch ( show, force ) {
|
67
|
+
if ( ! force ) return;
|
68
|
+
var arr = [ 'loader_back_id', 'loader_popup_id' ];
|
69
|
+
for ( var i in arr ) {
|
70
|
+
var obj = document.getElementById( arr[i] );
|
71
|
+
if ( obj ) obj.style.display = show ? 'block' : 'none';
|
72
|
+
}
|
73
|
+
return true;
|
74
|
+
}
|
75
|
+
</script>
|
76
|
+
<noscript></noscript>
|
77
|
+
|
78
|
+
<style type="text/css" media="screen">
|
79
|
+
html, body { padding:0px !important; margin:0px !important; }
|
80
|
+
body { height:100% !important; }
|
81
|
+
|
82
|
+
.loader_cover {
|
83
|
+
display:none; z-index:1000;
|
84
|
+
position:fixed; _position:absolute;
|
85
|
+
top:0px; left:0px; width:100%; height:100%;
|
86
|
+
}
|
87
|
+
.loader_back {
|
88
|
+
display:none; z-index:2000;
|
89
|
+
background-color:#fff;
|
90
|
+
}
|
91
|
+
.loader_popup {
|
92
|
+
display:none; z-index:3000;
|
93
|
+
}
|
94
|
+
.loader_popup_position {
|
95
|
+
position:absolute;
|
96
|
+
top:0%; left:50%;
|
97
|
+
width:0px; height:0px;
|
98
|
+
}
|
99
|
+
.loader_popup_message {
|
100
|
+
position:relative;
|
101
|
+
height:100px; width:200px; padding-top:25px;
|
102
|
+
top:0px; left:-100px;
|
103
|
+
line-height:40px !important;
|
104
|
+
color:#bbb; background-color:#fff; text-align:center;
|
105
|
+
font:bold 18px Arial,Helvetica,sans-serif;
|
106
|
+
}
|
107
|
+
|
108
|
+
#loader_wrapper_id { height: 100%; }
|
109
|
+
#loader_clear_id { clear: both; height: 0px; overflow: hidden; }
|
110
|
+
</style>
|
111
|
+
|
112
|
+
<script type="text/javascript">
|
113
|
+
document.write('\
|
114
|
+
<div id="loader_back_id" class="loader_cover loader_back"></div>\
|
115
|
+
<div id="loader_popup_id" class="loader_cover loader_popup">\
|
116
|
+
<div class="loader_popup_position">\
|
117
|
+
<div class="loader_popup_message">\
|
118
|
+
Bitte warten ...<br /><img src="/images/loader/gw-loading.gif" alt="" />\
|
119
|
+
</div>\
|
120
|
+
</div>\
|
121
|
+
</div>\
|
122
|
+
');
|
123
|
+
</script>
|
124
|
+
<noscript></noscript>
|
125
|
+
|
126
|
+
<script type="text/javascript"> LoaderDispatch(true,true); </script>
|
127
|
+
<noscript></noscript>
|
128
|
+
|
129
|
+
<title>moneybookers.com</title>
|
130
|
+
|
131
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
132
|
+
|
133
|
+
<meta name="Author" content="Moneybookers ltd.">
|
134
|
+
<meta name="Publisher" content="Moneybookers ltd.">
|
135
|
+
<meta name="Copyright" content="Moneybookers ltd.">
|
136
|
+
<meta name="robots" content="all,index,follow" />
|
137
|
+
<meta name="distribution" content="global" />
|
138
|
+
<meta name="rating" content="general" />
|
139
|
+
|
140
|
+
|
141
|
+
<link rel="icon" href="https://www.moneybookers.com/favicon.ico" type="image/vnd.microsoft.icon" />
|
142
|
+
<link rel="styleSheet" href="https://www.moneybookers.com/css/style_de.css" type="text/css" media="screen">
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
<link rel="styleSheet" href="https://www.moneybookers.com/css/onboarding.css" type="text/css" media="screen">
|
147
|
+
|
148
|
+
|
149
|
+
<link rel="styleSheet" href="https://www.moneybookers.com/css/gw/default/style.css" type="text/css" media="screen" />
|
150
|
+
<link rel="styleSheet" href="https://www.moneybookers.com/css/gw/default/btn.css" type="text/css" media="screen" />
|
151
|
+
|
152
|
+
<script type="text/javascript">
|
153
|
+
function ServerDate() {
|
154
|
+
//return server date as javascript Date object
|
155
|
+
return new Date(2010, 9 - 1, 13);
|
156
|
+
}
|
157
|
+
</script>
|
158
|
+
<script type="text/javascript" src="https://www.moneybookers.com/main.js"></script>
|
159
|
+
<script type="text/javascript" src="https://www.moneybookers.com/ourlib.js"></script>
|
160
|
+
<script type="text/javascript" src="https://www.moneybookers.com/regexp.js"></script>
|
161
|
+
<script type="text/javascript" src="https://www.moneybookers.com/swfobject.js"></script> <script type="text/javascript" src="https://www.moneybookers.com/js/jquery.js"></script>
|
162
|
+
|
163
|
+
<script type="text/javascript" src="https://www.moneybookers.com/js/jqplugins/qtip/mb.jquery.qtip.min.js"></script>
|
164
|
+
<script type="text/javascript">
|
165
|
+
|
166
|
+
// define variables that can be used from any script for specific reason
|
167
|
+
var hint_anchors = new Array();
|
168
|
+
</script>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
<script language="Javascript" src="https://www.moneybookers.com/js/gw.js"></script>
|
175
|
+
|
176
|
+
<script>
|
177
|
+
var mbcookie = getCookie("SESSION_ID");
|
178
|
+
if (mbcookie==null||mbcookie.length==0||navigator.cookieEnabled==0){
|
179
|
+
$(document).ready(function() {
|
180
|
+
$("body").html($("#mbcookie").html());
|
181
|
+
});
|
182
|
+
}
|
183
|
+
</script>
|
184
|
+
</head>
|
185
|
+
<body >
|
186
|
+
|
187
|
+
<!-- START: loader -->
|
188
|
+
<div id="loader_wrapper_id">
|
189
|
+
|
190
|
+
<!-- START: gateway content -->
|
191
|
+
<div id="gw_content_wrapper">
|
192
|
+
|
193
|
+
<script language="Javascript">
|
194
|
+
function get_turing_info() {
|
195
|
+
return "<b>Was hat es mit der Sicherheitsnummer auf sich?</b><br/>Die Eingabe der Sicherheitsnummer während der Anmeldung soll automatisierte, unbefugte Anmeldungen bei Ihrem Konto verhindern. Zum Fortfahren muss eine als Bild angezeigte Zufallszahl korrekt eingegeben werden.";
|
196
|
+
}
|
197
|
+
</script>
|
198
|
+
|
199
|
+
<script language="Javascript" src="https://www.moneybookers.com/ourlib.js"></script>
|
200
|
+
<div id="ourDiv" width="1" style="position:absolute; visibility:hidden; z-index:2;"></div>
|
201
|
+
|
202
|
+
|
203
|
+
<div id="preloader" class="preloader"> <img src="https://www.moneybookers.com/images/default/btn_right_disabled.gif" height="1" width="1" />
|
204
|
+
<img src="https://www.moneybookers.com/images/default/btn_right2.gif" height="1" width="1" />
|
205
|
+
<img src="https://www.moneybookers.com/images/default/btn_right.gif" height="1" width="1" />
|
206
|
+
<img src="https://www.moneybookers.com/images/default/btn_left_disabled.gif" height="1" width="1" />
|
207
|
+
<img src="https://www.moneybookers.com/images/default/btn_left2.gif" height="1" width="1" />
|
208
|
+
<img src="https://www.moneybookers.com/images/default/btn_left.gif" height="1" width="1" /></div>
|
209
|
+
<div id="logo_area"> <div class="logo_spacer"/>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
<form name="changeamount" action="payment.pl">
|
213
|
+
<div id="payment_info_expanded" style="display:none" > <div class="pay_to" title="Zahlung an seller_test@urbanvention.com" >Zahlung an seller_test@urbanvention.com</div> <dl class="row">
|
214
|
+
<dd class="col1">Bestellnummer:</dd>
|
215
|
+
<dd class="col2">FooBar123</dd>
|
216
|
+
<dd class="col3"> </dd>
|
217
|
+
<dd class="col4"> </dd>
|
218
|
+
</dl> <div>
|
219
|
+
<dl class="total" title="ZAHLUNGSSUMME">
|
220
|
+
<dd>ZAHLUNGSSUMME :</dd><dd class="price">100.00 </dd> </dl>
|
221
|
+
</div> <div class="collapse_area">
|
222
|
+
<a href="javascript:more_info(0);" class="collapse" title="Für weniger Informationen – Feld verkleinern"><span class="less_info">Weniger Informationen</span><strong>Für weniger Informationen – Feld verkleinern</strong></a>
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
<div id="payment_info_folded" style=""> <div class="pay_to" title="Zahlung an seller_test@urbanvention.com">Zahlung an seller_test@urbanvention.com</div> <dl class="total" title="ZAHLUNGSSUMME">
|
226
|
+
<dd>ZAHLUNGSSUMME :</dd><dd class="price">100.00 </dd> </dl> <div class="expand_area"><a href="javascript:more_info(1);" class="expand" title="Für mehr Informationen – Feld vergrößern"><span class="more_info">Mehr Informationen</span><strong>Für mehr Informationen – Feld vergrößern</strong></a></div>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
</form>
|
230
|
+
|
231
|
+
<script language="JavaScript">
|
232
|
+
function more_info (show) {
|
233
|
+
if ( $("#payment_info_folded") != null && $("#payment_info_expanded") != null) {
|
234
|
+
if ( show == 1) {
|
235
|
+
$("#payment_info_folded").slideUp('fast',function (){
|
236
|
+
$("#payment_info_expanded").slideDown('slow');
|
237
|
+
});
|
238
|
+
} else {
|
239
|
+
$("#payment_info_expanded").slideUp('slow',function (){
|
240
|
+
$("#payment_info_folded").slideDown('fast');
|
241
|
+
});
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
|
246
|
+
var init_rec_amount = '';
|
247
|
+
function calculate_total_amount( new_send_amount ){
|
248
|
+
var total_amount_rec = getObject('total_amount_rec');
|
249
|
+
if ( total_amount_rec != null && typeof(total_amount_rec) != 'undefined' ) {
|
250
|
+
var new_total_amount = init_rec_amount*1 + new_send_amount*1;
|
251
|
+
lwr(to_money(new_total_amount) + ' ', 'total_amount_rec');
|
252
|
+
}
|
253
|
+
} </script>
|
254
|
+
|
255
|
+
|
256
|
+
<script language="Javascript">
|
257
|
+
function get_turing_info() {
|
258
|
+
return "<b>Was hat es mit der Sicherheitsnummer auf sich?</b><br/>Die Eingabe der Sicherheitsnummer während der Anmeldung soll automatisierte, unbefugte Anmeldungen bei Ihrem Konto verhindern. Zum Fortfahren muss eine als Bild angezeigte Zufallszahl korrekt eingegeben werden.";
|
259
|
+
}
|
260
|
+
</script>
|
261
|
+
|
262
|
+
<script language="Javascript" src="https://www.moneybookers.com/ourlib.js"></script>
|
263
|
+
<div id="ourDiv" width="1" style="position:absolute; visibility:hidden; z-index:2;"></div>
|
264
|
+
|
265
|
+
<h1 class="title" style=>Transaktion nicht erlaubt </h1> <div class="gateway_content"> <dl>
|
266
|
+
<dd>Die vom Händler gewählte Währung für diese Zahlung wird von Moneybookers nicht unterstüzt. Bitte kontaktieren Sie ihren Händler um Unterstützung zu erhalten.</dd>
|
267
|
+
<dd><div class="separator" id="separator"></div>
|
268
|
+
<dl class="buttons"> <dd ><button type="button"
|
269
|
+
class="submit_btn"
|
270
|
+
value="Abbrechen" onclick="top.location='localhost:3000/payment_canceled';">
|
271
|
+
<span class="msg">ABBRECHEN</span></button> </dd></dl> </dd>
|
272
|
+
</dl> </div><div id="mbcookie" style="display:none"> <div class="gateway_content"> <dl> <dd>Bitte aktivieren Sie Ihre Cookies, damit Sie Moneybookers in vollem Umfang nutzen können.
|
273
|
+
|
274
|
+
Um Ihre Bezahlung an abzuschließen, müssen Sie Cookies von Moneybookers in den Einstellungen Ihres Browsers akzeptieren. Falls Sie Ihre Zugriffsrechte über die Software eines Drittherstellers verwalten, erlauben Sie dort bitte Cookies von Moneybookers um Ihre Transaktion erfolgreich durchzuführen.</dd> </dl>
|
275
|
+
<dl>
|
276
|
+
<dd><div class="separator" id="separator"></div>
|
277
|
+
<dl class="buttons"> <dd ><button type="button"
|
278
|
+
class="submit_btn"
|
279
|
+
value="Weiter" onclick="location.replace('https://www.moneybookers.com/app/payment.pl?sid=eb9e98f3dc5e70dda4e03834f35aa72b');">
|
280
|
+
<span class="msg">WEITER</span></button> </dd></dl> </dd>
|
281
|
+
</dl> </div></div>
|
282
|
+
|
283
|
+
<script language="JavaScript"> repositionHints();//attach hints (if any) to anchors elements
|
284
|
+
|
285
|
+
</script>
|
286
|
+
|
287
|
+
<!-- basename: payment, template_name: error -->
|
288
|
+
<script type="text/javascript" src="/js/tracker/init.js">/**/</script>
|
289
|
+
<script type="text/javascript"> customTracker( { _upage: '/de/payment/error' } ); </script>
|
290
|
+
|
291
|
+
</div>
|
292
|
+
<!-- END: gateway content -->
|
293
|
+
|
294
|
+
<!-- END: loader -->
|
295
|
+
<div id="loader_clear_id"></div>
|
296
|
+
</div>
|
297
|
+
|
298
|
+
<script type="text/javascript"> setTimeout( function () { LoaderDispatch(false,true); }, 200 ); </script>
|
299
|
+
<noscript></noscript>
|
300
|
+
|
301
|
+
</body>
|
302
|
+
</html>
|
303
|
+
RESPONSE
|
304
|
+
end
|
305
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activemerchant_moneybookers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jan Riethmayer
|
14
|
+
- Laurynas Butkus
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-01-28 00:00:00 +02:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: activemerchant
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 9
|
31
|
+
segments:
|
32
|
+
- 1
|
33
|
+
- 7
|
34
|
+
- 1
|
35
|
+
version: 1.7.1
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
description: Adds Moneybookers payment gateway support to ActiveMerchant library
|
39
|
+
email:
|
40
|
+
- laurynas.butkus@gmail.com
|
41
|
+
executables: []
|
42
|
+
|
43
|
+
extensions: []
|
44
|
+
|
45
|
+
extra_rdoc_files: []
|
46
|
+
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- MIT-LICENSE
|
51
|
+
- README.rdoc
|
52
|
+
- Rakefile
|
53
|
+
- activemerchant_moneybookers.gemspec
|
54
|
+
- init.rb
|
55
|
+
- lib/active_merchant/billing/gateways/moneybookers.rb
|
56
|
+
- lib/activemerchant_moneybookers.rb
|
57
|
+
- lib/activemerchant_moneybookers/version.rb
|
58
|
+
- test/test_helper.rb
|
59
|
+
- test/unit/gateways/moneybookers_test.rb
|
60
|
+
has_rdoc: true
|
61
|
+
homepage: http://rubygems.org/gems/activemerchant_moneybookers
|
62
|
+
licenses: []
|
63
|
+
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
requirements: []
|
88
|
+
|
89
|
+
rubyforge_project: activemerchant_moneybookers
|
90
|
+
rubygems_version: 1.3.7
|
91
|
+
signing_key:
|
92
|
+
specification_version: 3
|
93
|
+
summary: ActiveMerchant Moneybookers gateway
|
94
|
+
test_files: []
|
95
|
+
|