catarse_wepay 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +2 -2
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/app/controllers/catarse_wepay/wepay_controller.rb +5 -5
- data/lib/catarse_wepay/version.rb +1 -1
- data/spec/controllers/catarse_wepay/wepay_controller_spec.rb +5 -5
- data/spec/spec_helper.rb +1 -5
- data/test/dummy/config/{database.example.yml → database.yml} +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e242a14124ac3ea9abb6073cb49537f6b3a30348
|
4
|
+
data.tar.gz: 76f729a260addce0b4c93eee7b63dbf499af9352
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79c296946727f275aec8a02200828a568ea6e724d3c0f41e5deb8f3e6b3bcb75ccc9e491f9225abb1c296e8402adbead086339cf53b98d2ed64d3f8e895fdcef
|
7
|
+
data.tar.gz: ff7949eee97c8e8894da0e58c9f867de4c2169588c36de04dd352566ea83be0d5c30bf3dfca61c13148a5b934d7a31923e0c631c14c2d212671d46afc2da8a51
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
rvm:
|
2
2
|
- 1.9.3
|
3
3
|
- 2.0.0
|
4
|
+
- 2.1.0
|
4
5
|
|
5
6
|
before_script:
|
6
|
-
- "psql -c 'create
|
7
|
-
- "psql -c 'create database catarse_test;' -U catarse postgres"
|
7
|
+
- "psql -c 'create database catarse_test;' -U postgres postgres"
|
8
8
|
|
9
9
|
script:
|
10
10
|
- "bundle exec rspec spec"
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# CatarseWePay [](https://travis-ci.org/rafaelp/catarse_wepay)
|
1
|
+
# CatarseWePay [](https://travis-ci.org/rafaelp/catarse_wepay)
|
2
2
|
|
3
3
|
Catarse WePay express integration with [Catarse](http://github.com/catarse/catarse) crowdfunding platform
|
4
4
|
|
@@ -19,7 +19,7 @@ class CatarseWepay::WepayController < ApplicationController
|
|
19
19
|
flash[:alert] = refund_request.try(:message) || I18n.t('projects.contributions.refund.error')
|
20
20
|
end
|
21
21
|
|
22
|
-
redirect_to main_app.
|
22
|
+
redirect_to main_app.admin_contributions_path
|
23
23
|
end
|
24
24
|
|
25
25
|
def ipn
|
@@ -27,7 +27,7 @@ class CatarseWepay::WepayController < ApplicationController
|
|
27
27
|
response = gateway.call('/checkout', PaymentEngines.configuration[:wepay_access_token], {
|
28
28
|
checkout_id: contribution.payment_token,
|
29
29
|
})
|
30
|
-
PaymentEngines.create_payment_notification
|
30
|
+
PaymentEngines.create_payment_notification contribution_id: contribution.id, extra_data: response
|
31
31
|
if response["state"]
|
32
32
|
case response["state"].downcase
|
33
33
|
when 'captured'
|
@@ -68,7 +68,7 @@ class CatarseWepay::WepayController < ApplicationController
|
|
68
68
|
redirect_to response['checkout_uri']
|
69
69
|
else
|
70
70
|
flash[:failure] = t('wepay_error', scope: SCOPE)
|
71
|
-
return redirect_to main_app.
|
71
|
+
return redirect_to main_app.edit_project_contribution_path(project_id: contribution.project.id, id: contribution.id)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -82,10 +82,10 @@ class CatarseWepay::WepayController < ApplicationController
|
|
82
82
|
})
|
83
83
|
if response['state'] == 'authorized'
|
84
84
|
flash[:success] = t('success', scope: SCOPE)
|
85
|
-
redirect_to main_app.
|
85
|
+
redirect_to main_app.project_contribution_path(project_id: contribution.project.id, id: contribution.id)
|
86
86
|
else
|
87
87
|
flash[:failure] = t('wepay_error', scope: SCOPE)
|
88
|
-
redirect_to main_app.
|
88
|
+
redirect_to main_app.new_project_contribution_path(contribution.project)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -73,11 +73,11 @@ describe CatarseWepay::WepayController do
|
|
73
73
|
before do
|
74
74
|
success_refund = double
|
75
75
|
success_refund.stub(:success?).and_return(true)
|
76
|
-
main_app.should_receive(:
|
76
|
+
main_app.should_receive(:admin_contributions_path).and_return('admin_contributions_path')
|
77
77
|
gateway.should_receive(:call).with("/checkout/refund", "access-token", {:account_id=>"account-id", :checkout_id=>"508637826", :refund_reason=>"The customer changed his mind"}).and_return({'state' => 'refunded'})
|
78
78
|
post :refund, id: contribution.id, use_route: 'catarse_wepay'
|
79
79
|
end
|
80
|
-
it { should redirect_to('
|
80
|
+
it { should redirect_to('admin_contributions_path') }
|
81
81
|
end
|
82
82
|
describe "GET review" do
|
83
83
|
before do
|
@@ -125,7 +125,7 @@ describe CatarseWepay::WepayController do
|
|
125
125
|
redirect_uri: "http://test.host/catarse_wepay/payment/wepay/1/success",
|
126
126
|
callback_uri: "http://test.host/catarse_wepay/payment/wepay/ipn"
|
127
127
|
}).and_return(checkout_hash.merge('checkout_uri' => nil))
|
128
|
-
main_app.should_receive(:
|
128
|
+
main_app.should_receive(:edit_project_contribution_path).with(project_id: 1, id: 1).and_return('error url')
|
129
129
|
contribution.should_not_receive(:update_attributes)
|
130
130
|
end
|
131
131
|
it 'should assign flash error' do
|
@@ -161,7 +161,7 @@ describe CatarseWepay::WepayController do
|
|
161
161
|
let(:set_redirect_expectations) do
|
162
162
|
gateway.should_receive(:call).with("/checkout", "access-token", {:checkout_id=>"508637826"}).and_return(checkout_hash.merge('state' => 'authorized'))
|
163
163
|
main_app.
|
164
|
-
should_receive(:
|
164
|
+
should_receive(:project_contribution_path).
|
165
165
|
with(project_id: contribution.project.id, id: contribution.id).
|
166
166
|
and_return('back url')
|
167
167
|
end
|
@@ -174,7 +174,7 @@ describe CatarseWepay::WepayController do
|
|
174
174
|
let(:set_redirect_expectations) do
|
175
175
|
gateway.should_receive(:call).with("/checkout", "access-token", {:checkout_id=>"508637826"}).and_return(checkout_hash.merge('state' => 'failed'))
|
176
176
|
main_app.
|
177
|
-
should_receive(:
|
177
|
+
should_receive(:new_project_contribution_path).
|
178
178
|
with(contribution.project).
|
179
179
|
and_return('new back url')
|
180
180
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
2
|
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
|
4
|
-
raise "You should create file test/dummy/config/database.yml based on test/dummy/config/database.example.yml" unless File.exists?(File.expand_path("../../test/dummy/config/database.yml", __FILE__))
|
5
|
-
|
6
3
|
require File.expand_path("../../test/dummy/config/environment", __FILE__)
|
7
4
|
require 'rspec/rails'
|
8
5
|
require 'rspec/autorun'
|
9
6
|
|
10
|
-
|
11
7
|
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
12
8
|
|
13
9
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
@@ -44,7 +40,7 @@ end
|
|
44
40
|
|
45
41
|
def wepay_setup_purchase_success_response
|
46
42
|
{ "timestamp"=>"2012-07-23T00:24:21Z", "ack"=>"Success", "correlation_id"=>"dcb8596be51cd", "version"=>"62.0", "build"=>"3332236",
|
47
|
-
"token"=>"EC-49X25168KR2556548", "Timestamp"=>"2012-07-23T00:24:21Z", "Ack"=>"Success", "CorrelationID"=>"dcb8596be51cd",
|
43
|
+
"token"=>"EC-49X25168KR2556548", "Timestamp"=>"2012-07-23T00:24:21Z", "Ack"=>"Success", "CorrelationID"=>"dcb8596be51cd",
|
48
44
|
"Version"=>"62.0", "Build"=>"3332236", "Token"=>"EC-49X25168KR2556548" }
|
49
45
|
end
|
50
46
|
|
@@ -10,8 +10,8 @@
|
|
10
10
|
# Install PostgreSQL and put its /bin directory on your path.
|
11
11
|
development:
|
12
12
|
adapter: postgresql
|
13
|
-
encoding: utf-8
|
14
13
|
host: localhost
|
14
|
+
encoding: utf-8
|
15
15
|
database: catarse_development
|
16
16
|
pool: 5
|
17
17
|
username: postgres
|
@@ -37,8 +37,8 @@ development:
|
|
37
37
|
# Do not set this db to the same as development or production.
|
38
38
|
test: &test
|
39
39
|
adapter: postgresql
|
40
|
-
encoding: utf-8
|
41
40
|
host: localhost
|
41
|
+
encoding: utf-8
|
42
42
|
database: catarse_test
|
43
43
|
pool: 5
|
44
44
|
username: postgres
|
@@ -46,8 +46,8 @@ test: &test
|
|
46
46
|
|
47
47
|
production:
|
48
48
|
adapter: postgresql
|
49
|
-
encoding: utf-8
|
50
49
|
host: localhost
|
50
|
+
encoding: utf-8
|
51
51
|
database: catarse_production
|
52
52
|
pool: 5
|
53
53
|
username: postgres
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: catarse_wepay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Lima
|
@@ -141,7 +141,7 @@ files:
|
|
141
141
|
- test/dummy/config.ru
|
142
142
|
- test/dummy/config/application.rb
|
143
143
|
- test/dummy/config/boot.rb
|
144
|
-
- test/dummy/config/database.
|
144
|
+
- test/dummy/config/database.yml
|
145
145
|
- test/dummy/config/environment.rb
|
146
146
|
- test/dummy/config/environments/development.rb
|
147
147
|
- test/dummy/config/environments/production.rb
|
@@ -201,7 +201,7 @@ test_files:
|
|
201
201
|
- test/dummy/config.ru
|
202
202
|
- test/dummy/config/application.rb
|
203
203
|
- test/dummy/config/boot.rb
|
204
|
-
- test/dummy/config/database.
|
204
|
+
- test/dummy/config/database.yml
|
205
205
|
- test/dummy/config/environment.rb
|
206
206
|
- test/dummy/config/environments/development.rb
|
207
207
|
- test/dummy/config/environments/production.rb
|