spree_gateway 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +35 -93
- data/.gitignore +0 -14
- data/.rspec +0 -1
- data/.travis.yml +0 -22
- data/Gemfile +0 -14
- data/LICENSE +0 -26
- data/README.md +0 -68
- data/Rakefile +0 -14
- data/Versionfile +0 -12
- data/app/controllers/spree/checkout_controller_decorator.rb +0 -51
- data/app/controllers/spree/skrill_status_controller.rb +0 -39
- data/app/models/spree/billing_integration/skrill/quick_checkout.rb +0 -52
- data/app/models/spree/gateway/authorize_net.rb +0 -18
- data/app/models/spree/gateway/authorize_net_cim.rb +0 -134
- data/app/models/spree/gateway/balanced_gateway.rb +0 -68
- data/app/models/spree/gateway/banwire.rb +0 -16
- data/app/models/spree/gateway/beanstream.rb +0 -195
- data/app/models/spree/gateway/braintree_gateway.rb +0 -143
- data/app/models/spree/gateway/card_save.rb +0 -12
- data/app/models/spree/gateway/data_cash.rb +0 -12
- data/app/models/spree/gateway/eway.rb +0 -22
- data/app/models/spree/gateway/fatzebra.rb +0 -17
- data/app/models/spree/gateway/klarna.rb +0 -0
- data/app/models/spree/gateway/linkpoint.rb +0 -30
- data/app/models/spree/gateway/moneris.rb +0 -13
- data/app/models/spree/gateway/pay_junction.rb +0 -18
- data/app/models/spree/gateway/pay_pal_gateway.rb +0 -14
- data/app/models/spree/gateway/payflow_pro.rb +0 -19
- data/app/models/spree/gateway/paymill.rb +0 -15
- data/app/models/spree/gateway/pin_gateway.rb +0 -18
- data/app/models/spree/gateway/sage_pay.rb +0 -13
- data/app/models/spree/gateway/samurai.rb +0 -65
- data/app/models/spree/gateway/secure_pay_au.rb +0 -10
- data/app/models/spree/gateway/stripe_gateway.rb +0 -94
- data/app/models/spree/gateway/usa_epay.rb +0 -11
- data/app/models/spree/gateway/worldpay.rb +0 -96
- data/app/models/spree/payment_decorator.rb +0 -3
- data/app/models/spree/skrill_transaction.rb +0 -21
- data/app/views/spree/admin/payments/source_forms/_quickcheckout.html.erb +0 -8
- data/app/views/spree/admin/payments/source_views/_quickcheckout.html.erb +0 -39
- data/app/views/spree/checkout/payment/_quickcheckout.html.erb +0 -26
- data/config/locales/bg.yml +0 -11
- data/config/locales/de.yml +0 -11
- data/config/locales/en.yml +0 -11
- data/config/locales/sv.yml +0 -11
- data/config/routes.rb +0 -13
- data/db/migrate/20111118164631_create_skrill_transactions.rb +0 -14
- data/db/migrate/20121017004102_update_braintree_payment_method_type.rb +0 -9
- data/db/migrate/20130213222555_update_stripe_payment_method_type.rb +0 -9
- data/db/migrate/20130415222802_update_balanced_payment_method_type.rb +0 -9
- data/db/migrate/20131008221012_update_paypal_payment_method_type.rb +0 -9
- data/lib/active_merchant/billing/skrill.rb +0 -18
- data/lib/generators/spree_gateway/install/install_generator.rb +0 -28
- data/lib/spree_gateway/engine.rb +0 -41
- data/lib/spree_gateway.rb +0 -3
- data/script/rails +0 -5
- data/spec/factories/payment_method_factory.rb +0 -4
- data/spec/models/gateway/authorize_net_cim_spec.rb +0 -17
- data/spec/models/gateway/authorize_net_spec.rb +0 -17
- data/spec/models/gateway/balanced_gateway_spec.rb +0 -9
- data/spec/models/gateway/banwire_spec.rb +0 -9
- data/spec/models/gateway/braintree_gateway_spec.rb +0 -284
- data/spec/models/gateway/eway_spec.rb +0 -17
- data/spec/models/gateway/fatzebra_spec.rb +0 -47
- data/spec/models/gateway/linkpoint_spec.rb +0 -60
- data/spec/models/gateway/pay_junction_spec.rb +0 -17
- data/spec/models/gateway/payflow_pro_spec.rb +0 -17
- data/spec/models/gateway/pin_gateway_spec.rb +0 -57
- data/spec/models/gateway/stripe_gateway_spec.rb +0 -122
- data/spec/models/gateway/usa_epay_spec.rb +0 -38
- data/spec/spec_helper.rb +0 -34
- data/spree_gateway.gemspec +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5d3726bd0c9b7b135b3f5dacbcfd398d31aabfd
|
4
|
+
data.tar.gz: fc69e94bee6f5c693bcf4a755eabc1cb8ac3444f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76f307329dcff7d747c82f09128f5f31a7f373a7a68cf613fcd92a09484a7dd8fc31ee39f786256e20608655183836bfe998247b6051f5bec91a61ababbc074f
|
7
|
+
data.tar.gz: 4f310eade2edd90abf2aa86ca04846555256c94ed24522676195b6354d295b55791b7e160e7aee91ecc5e3bef5060916c7b2c5f0fef33d7dda703dd8ac5d58a8
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spree Commerce
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: '2.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: savon
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,84 +80,41 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: capybara
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.1.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.1.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: launchy
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
description: Additional Payment Gateways for Spree Commerce
|
84
|
-
email:
|
112
|
+
email: ryan@spreecommerce.com
|
85
113
|
executables: []
|
86
114
|
extensions: []
|
87
115
|
extra_rdoc_files: []
|
88
|
-
files:
|
89
|
-
|
90
|
-
- ".rspec"
|
91
|
-
- ".travis.yml"
|
92
|
-
- Gemfile
|
93
|
-
- LICENSE
|
94
|
-
- README.md
|
95
|
-
- Rakefile
|
96
|
-
- Versionfile
|
97
|
-
- app/controllers/spree/checkout_controller_decorator.rb
|
98
|
-
- app/controllers/spree/skrill_status_controller.rb
|
99
|
-
- app/models/spree/billing_integration/skrill/quick_checkout.rb
|
100
|
-
- app/models/spree/gateway/authorize_net.rb
|
101
|
-
- app/models/spree/gateway/authorize_net_cim.rb
|
102
|
-
- app/models/spree/gateway/balanced_gateway.rb
|
103
|
-
- app/models/spree/gateway/banwire.rb
|
104
|
-
- app/models/spree/gateway/beanstream.rb
|
105
|
-
- app/models/spree/gateway/braintree_gateway.rb
|
106
|
-
- app/models/spree/gateway/card_save.rb
|
107
|
-
- app/models/spree/gateway/data_cash.rb
|
108
|
-
- app/models/spree/gateway/eway.rb
|
109
|
-
- app/models/spree/gateway/fatzebra.rb
|
110
|
-
- app/models/spree/gateway/klarna.rb
|
111
|
-
- app/models/spree/gateway/linkpoint.rb
|
112
|
-
- app/models/spree/gateway/moneris.rb
|
113
|
-
- app/models/spree/gateway/pay_junction.rb
|
114
|
-
- app/models/spree/gateway/pay_pal_gateway.rb
|
115
|
-
- app/models/spree/gateway/payflow_pro.rb
|
116
|
-
- app/models/spree/gateway/paymill.rb
|
117
|
-
- app/models/spree/gateway/pin_gateway.rb
|
118
|
-
- app/models/spree/gateway/sage_pay.rb
|
119
|
-
- app/models/spree/gateway/samurai.rb
|
120
|
-
- app/models/spree/gateway/secure_pay_au.rb
|
121
|
-
- app/models/spree/gateway/stripe_gateway.rb
|
122
|
-
- app/models/spree/gateway/usa_epay.rb
|
123
|
-
- app/models/spree/gateway/worldpay.rb
|
124
|
-
- app/models/spree/payment_decorator.rb
|
125
|
-
- app/models/spree/skrill_transaction.rb
|
126
|
-
- app/views/spree/admin/payments/source_forms/_quickcheckout.html.erb
|
127
|
-
- app/views/spree/admin/payments/source_views/_quickcheckout.html.erb
|
128
|
-
- app/views/spree/checkout/payment/_quickcheckout.html.erb
|
129
|
-
- config/locales/bg.yml
|
130
|
-
- config/locales/de.yml
|
131
|
-
- config/locales/en.yml
|
132
|
-
- config/locales/sv.yml
|
133
|
-
- config/routes.rb
|
134
|
-
- db/migrate/20111118164631_create_skrill_transactions.rb
|
135
|
-
- db/migrate/20121017004102_update_braintree_payment_method_type.rb
|
136
|
-
- db/migrate/20130213222555_update_stripe_payment_method_type.rb
|
137
|
-
- db/migrate/20130415222802_update_balanced_payment_method_type.rb
|
138
|
-
- db/migrate/20131008221012_update_paypal_payment_method_type.rb
|
139
|
-
- lib/active_merchant/billing/skrill.rb
|
140
|
-
- lib/generators/spree_gateway/install/install_generator.rb
|
141
|
-
- lib/spree_gateway.rb
|
142
|
-
- lib/spree_gateway/engine.rb
|
143
|
-
- script/rails
|
144
|
-
- spec/factories/payment_method_factory.rb
|
145
|
-
- spec/models/gateway/authorize_net_cim_spec.rb
|
146
|
-
- spec/models/gateway/authorize_net_spec.rb
|
147
|
-
- spec/models/gateway/balanced_gateway_spec.rb
|
148
|
-
- spec/models/gateway/banwire_spec.rb
|
149
|
-
- spec/models/gateway/braintree_gateway_spec.rb
|
150
|
-
- spec/models/gateway/eway_spec.rb
|
151
|
-
- spec/models/gateway/fatzebra_spec.rb
|
152
|
-
- spec/models/gateway/linkpoint_spec.rb
|
153
|
-
- spec/models/gateway/pay_junction_spec.rb
|
154
|
-
- spec/models/gateway/payflow_pro_spec.rb
|
155
|
-
- spec/models/gateway/pin_gateway_spec.rb
|
156
|
-
- spec/models/gateway/stripe_gateway_spec.rb
|
157
|
-
- spec/models/gateway/usa_epay_spec.rb
|
158
|
-
- spec/spec_helper.rb
|
159
|
-
- spree_gateway.gemspec
|
160
|
-
homepage: http://www.spreecommerce.com
|
116
|
+
files: []
|
117
|
+
homepage: http://www.spreecommerce.org
|
161
118
|
licenses:
|
162
119
|
- BSD-3
|
163
120
|
metadata: {}
|
@@ -182,19 +139,4 @@ rubygems_version: 2.2.0
|
|
182
139
|
signing_key:
|
183
140
|
specification_version: 4
|
184
141
|
summary: Additional Payment Gateways for Spree Commerce
|
185
|
-
test_files:
|
186
|
-
- spec/factories/payment_method_factory.rb
|
187
|
-
- spec/models/gateway/authorize_net_cim_spec.rb
|
188
|
-
- spec/models/gateway/authorize_net_spec.rb
|
189
|
-
- spec/models/gateway/balanced_gateway_spec.rb
|
190
|
-
- spec/models/gateway/banwire_spec.rb
|
191
|
-
- spec/models/gateway/braintree_gateway_spec.rb
|
192
|
-
- spec/models/gateway/eway_spec.rb
|
193
|
-
- spec/models/gateway/fatzebra_spec.rb
|
194
|
-
- spec/models/gateway/linkpoint_spec.rb
|
195
|
-
- spec/models/gateway/pay_junction_spec.rb
|
196
|
-
- spec/models/gateway/payflow_pro_spec.rb
|
197
|
-
- spec/models/gateway/pin_gateway_spec.rb
|
198
|
-
- spec/models/gateway/stripe_gateway_spec.rb
|
199
|
-
- spec/models/gateway/usa_epay_spec.rb
|
200
|
-
- spec/spec_helper.rb
|
142
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour
|
data/.travis.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
before_script:
|
3
|
-
- sh -e /etc/init.d/xvfb start
|
4
|
-
- export DISPLAY=:99.0
|
5
|
-
- bundle exec rake test_app
|
6
|
-
env:
|
7
|
-
- DB=sqlite
|
8
|
-
- DB=mysql
|
9
|
-
- DB=postgres
|
10
|
-
script:
|
11
|
-
- bundle exec rspec spec
|
12
|
-
notifications:
|
13
|
-
email:
|
14
|
-
- ryan@spreecommerce.com
|
15
|
-
irc:
|
16
|
-
use_notice: true
|
17
|
-
skip_join: true
|
18
|
-
channels:
|
19
|
-
- "irc.freenode.org#spree"
|
20
|
-
rvm:
|
21
|
-
- 1.9.3
|
22
|
-
- 2.0.0
|
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 Spree Commerce
|
2
|
-
All rights reserved.
|
3
|
-
|
4
|
-
Redistribution and use in source and binary forms, with or without modification,
|
5
|
-
are permitted provided that the following conditions are met:
|
6
|
-
|
7
|
-
* Redistributions of source code must retain the above copyright notice,
|
8
|
-
this list of conditions and the following disclaimer.
|
9
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer in the documentation
|
11
|
-
and/or other materials provided with the distribution.
|
12
|
-
* Neither the name Spree nor the names of its contributors may be used to
|
13
|
-
endorse or promote products derived from this software without specific
|
14
|
-
prior written permission.
|
15
|
-
|
16
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
20
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
21
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
-
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
23
|
-
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
# Spree Gateway
|
2
|
-
|
3
|
-
[![Build Status](https://secure.travis-ci.org/spree/spree_gateway.png?branch=master)](http://travis-ci.org/spree/spree_gateway)
|
4
|
-
|
5
|
-
Community supported Spree Payment Method Gateways.
|
6
|
-
|
7
|
-
These can be used with Spree >= 1.0.x (but see note below for necessary changes)
|
8
|
-
|
9
|
-
http://guides.spreecommerce.com/developer/payments.html
|
10
|
-
|
11
|
-
## Installation
|
12
|
-
|
13
|
-
In your Gemfile:
|
14
|
-
|
15
|
-
**Spree edge**
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
gem 'spree'
|
19
|
-
gem 'spree_gateway', github: 'spree/spree_gateway'
|
20
|
-
```
|
21
|
-
|
22
|
-
**Spree 1.3**
|
23
|
-
|
24
|
-
```ruby
|
25
|
-
gem 'spree', '~> 1.3'
|
26
|
-
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '1-3-stable'
|
27
|
-
```
|
28
|
-
|
29
|
-
**Note:** *Please consult the Versionfile at the root of the repository to determine which branch to use.*
|
30
|
-
|
31
|
-
Then run from the command line:
|
32
|
-
|
33
|
-
$ bundle install
|
34
|
-
$ rails g spree_gateway:install
|
35
|
-
|
36
|
-
Finally, make sure to **restart your app**. Navigate to *Configuration > Payment Methods > New Payment Method* in the admin panel and you should see that a bunch of additional gateways have been added to the list.
|
37
|
-
|
38
|
-
## Contributing
|
39
|
-
|
40
|
-
In the spirit of [free software][1], **everyone** is encouraged to help improve this project.
|
41
|
-
|
42
|
-
Here are some ways *you* can contribute:
|
43
|
-
|
44
|
-
* by using prerelease versions
|
45
|
-
* by reporting [bugs][2]
|
46
|
-
* by suggesting new features
|
47
|
-
* by writing or editing documentation
|
48
|
-
* by writing specifications
|
49
|
-
* by writing code (*no patch is too small*: fix typos, add comments, clean up inconsistent whitespace)
|
50
|
-
* by refactoring code
|
51
|
-
* by resolving [issues][2]
|
52
|
-
* by reviewing patches
|
53
|
-
|
54
|
-
Starting point:
|
55
|
-
|
56
|
-
* Fork the repo
|
57
|
-
* Clone your repo
|
58
|
-
* Run `bundle`
|
59
|
-
* Run `bundle exec rake test_app` to create the test application in `spec/test_app`
|
60
|
-
* Make your changes
|
61
|
-
* Ensure specs pass by running `bundle exec rspec spec`
|
62
|
-
* Submit your pull request
|
63
|
-
|
64
|
-
Copyright (c) 2013 Spree Commerce, released under the [New BSD License][3]
|
65
|
-
|
66
|
-
[1]: http://www.fsf.org/licensing/essays/free-sw.html
|
67
|
-
[2]: https://github.com/futhr/spree-dibs/issues
|
68
|
-
[3]: https://github.com/spree/spree_gateway/tree/master/LICENSE
|
data/Rakefile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
require 'spree/testing_support/common_rake'
|
4
|
-
require 'bundler/gem_tasks'
|
5
|
-
|
6
|
-
RSpec::Core::RakeTask.new
|
7
|
-
|
8
|
-
task :default => [:spec]
|
9
|
-
|
10
|
-
desc "Generates a dummy app for testing"
|
11
|
-
task :test_app do
|
12
|
-
ENV['LIB_NAME'] = 'spree_gateway'
|
13
|
-
Rake::Task['common:test_app'].invoke
|
14
|
-
end
|
data/Versionfile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# This file is used to designate compatibilty with different versions of Spree
|
2
|
-
# Please see http://spreecommerce.com/documentation/extensions.html#versionfile for details
|
3
|
-
|
4
|
-
# Examples
|
5
|
-
#
|
6
|
-
|
7
|
-
"2.1.x" => { :branch => "master" }
|
8
|
-
"2.0.x" => { :branch => "2-0-stable" }
|
9
|
-
"1.3.x" => { :branch => "1-3-stable" }
|
10
|
-
"1.2.x" => { :branch => "1-2-stable" }
|
11
|
-
"1.1.x" => { :branch => "1-1-stable" }
|
12
|
-
"1.0.x" => { :branch => "1-0-stable" }
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
CheckoutController.class_eval do
|
3
|
-
before_filter :confirm_skrill, :only => [:update]
|
4
|
-
|
5
|
-
def skrill_return
|
6
|
-
|
7
|
-
unless @order.payments.where(:source_type => 'Spree::SkrillTransaction').present?
|
8
|
-
payment_method = PaymentMethod.find(params[:payment_method_id])
|
9
|
-
skrill_transaction = SkrillTransaction.new
|
10
|
-
|
11
|
-
payment = @order.payments.create({:amount => @order.total,
|
12
|
-
:source => skrill_transaction,
|
13
|
-
:payment_method => payment_method},
|
14
|
-
:without_protection => true)
|
15
|
-
payment.started_processing!
|
16
|
-
payment.pend!
|
17
|
-
end
|
18
|
-
|
19
|
-
@order.update_attributes({:state => "complete", :completed_at => Time.now}, :without_protection => true)
|
20
|
-
|
21
|
-
until @order.state == "complete"
|
22
|
-
if @order.next!
|
23
|
-
@order.update!
|
24
|
-
state_callback(:after)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
@order.finalize!
|
29
|
-
|
30
|
-
flash.notice = Spree.t(:order_processed_successfully)
|
31
|
-
redirect_to completion_route
|
32
|
-
end
|
33
|
-
|
34
|
-
def skrill_cancel
|
35
|
-
flash[:error] = Spree.t(:payment_has_been_cancelled)
|
36
|
-
redirect_to edit_order_path(@order)
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
def confirm_skrill
|
41
|
-
return unless (params[:state] == "payment") && params[:order][:payments_attributes]
|
42
|
-
|
43
|
-
payment_method = PaymentMethod.find(params[:order][:payments_attributes].first[:payment_method_id])
|
44
|
-
if payment_method.kind_of?(BillingIntegration::Skrill::QuickCheckout)
|
45
|
-
#TODO confirming payment method
|
46
|
-
redirect_to edit_order_checkout_url(@order, :state => 'payment'),
|
47
|
-
:notice => Spree.t(:complete_skrill_checkout)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
class SkrillStatusController < ApplicationController
|
3
|
-
def update
|
4
|
-
@order = Order.find_by_number!(params[:order_id])
|
5
|
-
payment_method = PaymentMethod.find(params[:payment_method_id])
|
6
|
-
skrill_transaction = SkrillTransaction.create_from_postback params
|
7
|
-
|
8
|
-
payment = @order.payments.where(:state => "pending",
|
9
|
-
:payment_method_id => payment_method).first
|
10
|
-
|
11
|
-
if payment
|
12
|
-
payment.source = skrill_transaction
|
13
|
-
payment.save
|
14
|
-
else
|
15
|
-
payment = @order.payments.create(:amount => @order.total,
|
16
|
-
:source => skrill_transaction,
|
17
|
-
:payment_method => payment_method)
|
18
|
-
end
|
19
|
-
|
20
|
-
payment.started_processing!
|
21
|
-
|
22
|
-
unless payment.completed?
|
23
|
-
case params[:status]
|
24
|
-
when "0"
|
25
|
-
payment.pend #may already be pending
|
26
|
-
when "2" #processed / captured
|
27
|
-
payment.complete!
|
28
|
-
when "-1", "-2"
|
29
|
-
payment.failure!
|
30
|
-
else
|
31
|
-
raise "Unexpected payment status"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
render :text => ""
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
class BillingIntegration::Skrill::QuickCheckout < BillingIntegration
|
3
|
-
preference :merchant_id, :string
|
4
|
-
preference :language, :string, :default => 'EN'
|
5
|
-
preference :currency, :string, :default => 'EUR'
|
6
|
-
preference :payment_options, :string, :default => 'ACC'
|
7
|
-
preference :pay_to_email, :string , :default => 'your@merchant.email_here'
|
8
|
-
|
9
|
-
attr_accessible :preferred_merchant_id, :preferred_language, :preferred_currency,
|
10
|
-
:preferred_payment_options, :preferred_server, :preferred_test_mode,
|
11
|
-
:preferred_pay_to_email
|
12
|
-
|
13
|
-
def provider_class
|
14
|
-
ActiveMerchant::Billing::Skrill
|
15
|
-
end
|
16
|
-
|
17
|
-
def redirect_url(order, opts = {})
|
18
|
-
opts.merge! self.preferences
|
19
|
-
|
20
|
-
set_global_options(opts)
|
21
|
-
|
22
|
-
opts[:detail1_text] = order.number
|
23
|
-
opts[:detail1_description] = "Order:"
|
24
|
-
|
25
|
-
opts[:pay_from_email] = order.email
|
26
|
-
opts[:firstname] = order.bill_address.firstname
|
27
|
-
opts[:lastname] = order.bill_address.lastname
|
28
|
-
opts[:address] = order.bill_address.address1
|
29
|
-
opts[:address2] = order.bill_address.address2
|
30
|
-
opts[:phone_number] = order.bill_address.phone.gsub(/\D/,'') if order.bill_address.phone
|
31
|
-
opts[:city] = order.bill_address.city
|
32
|
-
opts[:postal_code] = order.bill_address.zipcode
|
33
|
-
opts[:state] = order.bill_address.state.nil? ? order.bill_address.state_name.to_s : order.bill_address.state.abbr
|
34
|
-
opts[:country] = order.bill_address.country.name
|
35
|
-
opts[:pay_to_email] = self.preferred_pay_to_email
|
36
|
-
opts[:hide_login] = 1
|
37
|
-
opts[:merchant_fields] = 'platform,order_id,payment_method_id'
|
38
|
-
opts[:platform] = 'Spree'
|
39
|
-
opts[:order_id] = order.number
|
40
|
-
|
41
|
-
skrill = self.provider
|
42
|
-
skrill.payment_url(opts)
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
def set_global_options(opts)
|
47
|
-
opts[:recipient_description] = Spree::Config[:site_name]
|
48
|
-
opts[:payment_methods] = self.preferred_payment_options
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
class Gateway::AuthorizeNet < Gateway
|
3
|
-
preference :login, :string
|
4
|
-
preference :password, :string
|
5
|
-
|
6
|
-
attr_accessible :preferred_login, :preferred_password
|
7
|
-
|
8
|
-
def provider_class
|
9
|
-
ActiveMerchant::Billing::AuthorizeNetGateway
|
10
|
-
end
|
11
|
-
|
12
|
-
def options_with_test_preference
|
13
|
-
options_without_test_preference.merge(:test => self.preferred_test_mode)
|
14
|
-
end
|
15
|
-
|
16
|
-
alias_method_chain :options, :test_preference
|
17
|
-
end
|
18
|
-
end
|
@@ -1,134 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
class Gateway::AuthorizeNetCim < Gateway
|
3
|
-
preference :login, :string
|
4
|
-
preference :password, :string
|
5
|
-
preference :test_mode, :boolean, :default => false
|
6
|
-
preference :validate_on_profile_create, :boolean, :default => false
|
7
|
-
|
8
|
-
attr_accessible :preferred_login, :preferred_password, :preferred_test_mode, :preferred_validate_on_profile_create
|
9
|
-
|
10
|
-
ActiveMerchant::Billing::Response.class_eval do
|
11
|
-
attr_writer :authorization
|
12
|
-
end
|
13
|
-
|
14
|
-
def provider_class
|
15
|
-
self.class
|
16
|
-
end
|
17
|
-
|
18
|
-
def options
|
19
|
-
# add :test key in the options hash, as that is what the ActiveMerchant::Billing::AuthorizeNetGateway expects
|
20
|
-
if self.preferred_test_mode
|
21
|
-
self.class.preference :test, :boolean, :default => true
|
22
|
-
else
|
23
|
-
self.class.remove_preference :test
|
24
|
-
end
|
25
|
-
|
26
|
-
super
|
27
|
-
end
|
28
|
-
|
29
|
-
def authorize(amount, creditcard, gateway_options)
|
30
|
-
t_options = { :order => {:invoice_number => gateway_options[:order_id] } }
|
31
|
-
create_transaction( amount, creditcard, :auth_only, t_options )
|
32
|
-
end
|
33
|
-
|
34
|
-
def purchase(amount, creditcard, gateway_options)
|
35
|
-
create_transaction(amount, creditcard, :auth_capture)
|
36
|
-
end
|
37
|
-
|
38
|
-
def capture(authorization, creditcard, gateway_options)
|
39
|
-
create_transaction((authorization.amount * 100).round, creditcard, :prior_auth_capture, :trans_id => authorization.response_code)
|
40
|
-
end
|
41
|
-
|
42
|
-
def credit(amount, creditcard, response_code, gateway_options)
|
43
|
-
create_transaction(amount, creditcard, :refund, :trans_id => response_code)
|
44
|
-
end
|
45
|
-
|
46
|
-
def void(response_code, creditcard, gateway_options)
|
47
|
-
create_transaction(nil, creditcard, :void, :trans_id => response_code)
|
48
|
-
end
|
49
|
-
|
50
|
-
def payment_profiles_supported?
|
51
|
-
true
|
52
|
-
end
|
53
|
-
|
54
|
-
# Create a new CIM customer profile ready to accept a payment
|
55
|
-
def create_profile(payment)
|
56
|
-
if payment.source.gateway_customer_profile_id.nil?
|
57
|
-
profile_hash = create_customer_profile(payment)
|
58
|
-
payment.source.update_attributes(:gateway_customer_profile_id => profile_hash[:customer_profile_id], :gateway_payment_profile_id => profile_hash[:customer_payment_profile_id])
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# simpler form
|
63
|
-
def create_profile_from_card(card)
|
64
|
-
if card.gateway_customer_profile_id.nil?
|
65
|
-
profile_hash = create_customer_profile(card)
|
66
|
-
card.update_attributes(:gateway_customer_profile_id => profile_hash[:customer_profile_id], :gateway_payment_profile_id => profile_hash[:customer_payment_profile_id])
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
# Create a transaction on a creditcard
|
72
|
-
# Set up a CIM profile for the card if one doesn't exist
|
73
|
-
# Valid transaction_types are :auth_only, :capture_only and :auth_capture
|
74
|
-
def create_transaction(amount, creditcard, transaction_type, options = {})
|
75
|
-
#create_profile(creditcard, creditcard.gateway_options)
|
76
|
-
creditcard.save
|
77
|
-
if amount
|
78
|
-
amount = "%.2f" % (amount / 100.0) # This gateway requires formated decimal, not cents
|
79
|
-
end
|
80
|
-
transaction_options = {
|
81
|
-
:type => transaction_type,
|
82
|
-
:amount => amount,
|
83
|
-
:customer_profile_id => creditcard.gateway_customer_profile_id,
|
84
|
-
:customer_payment_profile_id => creditcard.gateway_payment_profile_id,
|
85
|
-
}.update(options)
|
86
|
-
t = cim_gateway.create_customer_profile_transaction(:transaction => transaction_options)
|
87
|
-
logger.debug("\nAuthorize Net CIM Transaction")
|
88
|
-
logger.debug(" transaction_options: #{transaction_options.inspect}")
|
89
|
-
logger.debug(" response: #{t.inspect}\n")
|
90
|
-
t
|
91
|
-
end
|
92
|
-
|
93
|
-
# Create a new CIM customer profile ready to accept a payment
|
94
|
-
def create_customer_profile(payment)
|
95
|
-
options = options_for_create_customer_profile(payment)
|
96
|
-
response = cim_gateway.create_customer_profile(options)
|
97
|
-
if response.success?
|
98
|
-
{ :customer_profile_id => response.params['customer_profile_id'],
|
99
|
-
:customer_payment_profile_id => response.params['customer_payment_profile_id_list'].values.first }
|
100
|
-
else
|
101
|
-
payment.send(:gateway_error, response)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def options_for_create_customer_profile(payment)
|
106
|
-
if payment.is_a? CreditCard
|
107
|
-
info = { :bill_to => generate_address_hash(payment.address), :payment => { :credit_card => payment } }
|
108
|
-
else
|
109
|
-
info = { :bill_to => generate_address_hash(payment.order.bill_address),
|
110
|
-
:payment => { :credit_card => payment.source } }
|
111
|
-
end
|
112
|
-
validation_mode = preferred_validate_on_profile_create ? preferred_server.to_sym : :none
|
113
|
-
|
114
|
-
{ :profile => { :merchant_customer_id => "#{Time.now.to_f}",
|
115
|
-
#:ship_to_list => generate_address_hash(creditcard.checkout.ship_address),
|
116
|
-
:email => payment.order.email,
|
117
|
-
:payment_profiles => info },
|
118
|
-
:validation_mode => validation_mode }
|
119
|
-
end
|
120
|
-
|
121
|
-
# As in PaymentGateway but with separate name fields
|
122
|
-
def generate_address_hash(address)
|
123
|
-
return {} if address.nil?
|
124
|
-
{:first_name => address.firstname, :last_name => address.lastname, :address1 => address.address1, :address2 => address.address2, :city => address.city,
|
125
|
-
:state => address.state_text, :zip => address.zipcode, :country => address.country.iso, :phone_number => address.phone}
|
126
|
-
end
|
127
|
-
|
128
|
-
def cim_gateway
|
129
|
-
ActiveMerchant::Billing::Base.gateway_mode = preferred_server.to_sym
|
130
|
-
gateway_options = options
|
131
|
-
ActiveMerchant::Billing::AuthorizeNetCimGateway.new(gateway_options)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|