catarse_wepay 0.0.1
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 +7 -0
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +14 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +122 -0
- data/MIT-LICENSE +20 -0
- data/README.md +63 -0
- data/Rakefile +36 -0
- data/app/assets/javascripts/catarse_wepay/paypal_form.js +18 -0
- data/app/assets/javascripts/catarse_wepay.js +5 -0
- data/app/controllers/.gitkeep +0 -0
- data/app/controllers/catarse_wepay/wepay_controller.rb +105 -0
- data/app/views/catarse_wepay/wepay/review.html.slim +10 -0
- data/catarse_wepay.gemspec +27 -0
- data/config/initializers/register.rb +14 -0
- data/config/locales/en.yml +17 -0
- data/config/locales/pt.yml +18 -0
- data/config/routes.rb +15 -0
- data/lib/catarse_wepay/engine.rb +6 -0
- data/lib/catarse_wepay/version.rb +3 -0
- data/lib/catarse_wepay.rb +5 -0
- data/lib/tasks/catarse_paypal_express_tasks.rake +4 -0
- data/script/rails +9 -0
- data/spec/controllers/catarse_wepay/wepay_controller_spec.rb +234 -0
- data/spec/spec_helper.rb +65 -0
- data/spec/support/payment_engines.rb +3 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.example.yml +53 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- metadata +224 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5cdc4e97b1da5bb5d7ed459de624a43507435651
|
4
|
+
data.tar.gz: ae0d830b5cc7d3f61fae894d8f32670b47132c0b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 67ef5847f18e7909ceee365e0d3c33d1aa8311d19d1f6ae59f850ae2e3fa620cbbc71978f633bca7944e42750a770a6d99cfa3a0fda9ca549c51648a19f091f4
|
7
|
+
data.tar.gz: 70438ec3eacb4fa0c9fe57512df2cf914b726e09c674150904af6589e43081debef85f12997193fa1ee512427cdaa9649ac7b34bd4fe8a1b836d6e6a382abf83
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
catarse_wepay
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.0
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
catarse_wepay (0.0.1)
|
5
|
+
rails (~> 4.0)
|
6
|
+
slim-rails
|
7
|
+
wepay (= 0.0.1)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
actionmailer (4.0.0)
|
13
|
+
actionpack (= 4.0.0)
|
14
|
+
mail (~> 2.5.3)
|
15
|
+
actionpack (4.0.0)
|
16
|
+
activesupport (= 4.0.0)
|
17
|
+
builder (~> 3.1.0)
|
18
|
+
erubis (~> 2.7.0)
|
19
|
+
rack (~> 1.5.2)
|
20
|
+
rack-test (~> 0.6.2)
|
21
|
+
activemodel (4.0.0)
|
22
|
+
activesupport (= 4.0.0)
|
23
|
+
builder (~> 3.1.0)
|
24
|
+
activerecord (4.0.0)
|
25
|
+
activemodel (= 4.0.0)
|
26
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
27
|
+
activesupport (= 4.0.0)
|
28
|
+
arel (~> 4.0.0)
|
29
|
+
activerecord-deprecated_finders (1.0.3)
|
30
|
+
activesupport (4.0.0)
|
31
|
+
i18n (~> 0.6, >= 0.6.4)
|
32
|
+
minitest (~> 4.2)
|
33
|
+
multi_json (~> 1.3)
|
34
|
+
thread_safe (~> 0.1)
|
35
|
+
tzinfo (~> 0.3.37)
|
36
|
+
arel (4.0.1)
|
37
|
+
atomic (1.1.13)
|
38
|
+
builder (3.1.4)
|
39
|
+
database_cleaner (1.1.1)
|
40
|
+
diff-lcs (1.2.4)
|
41
|
+
erubis (2.7.0)
|
42
|
+
factory_girl (4.2.0)
|
43
|
+
activesupport (>= 3.0.0)
|
44
|
+
factory_girl_rails (4.2.1)
|
45
|
+
factory_girl (~> 4.2.0)
|
46
|
+
railties (>= 3.0.0)
|
47
|
+
hike (1.2.3)
|
48
|
+
i18n (0.6.5)
|
49
|
+
mail (2.5.4)
|
50
|
+
mime-types (~> 1.16)
|
51
|
+
treetop (~> 1.4.8)
|
52
|
+
mime-types (1.25.1)
|
53
|
+
minitest (4.7.5)
|
54
|
+
multi_json (1.7.9)
|
55
|
+
pg (0.16.0)
|
56
|
+
polyglot (0.3.3)
|
57
|
+
rack (1.5.2)
|
58
|
+
rack-test (0.6.2)
|
59
|
+
rack (>= 1.0)
|
60
|
+
rails (4.0.0)
|
61
|
+
actionmailer (= 4.0.0)
|
62
|
+
actionpack (= 4.0.0)
|
63
|
+
activerecord (= 4.0.0)
|
64
|
+
activesupport (= 4.0.0)
|
65
|
+
bundler (>= 1.3.0, < 2.0)
|
66
|
+
railties (= 4.0.0)
|
67
|
+
sprockets-rails (~> 2.0.0)
|
68
|
+
railties (4.0.0)
|
69
|
+
actionpack (= 4.0.0)
|
70
|
+
activesupport (= 4.0.0)
|
71
|
+
rake (>= 0.8.7)
|
72
|
+
thor (>= 0.18.1, < 2.0)
|
73
|
+
rake (10.1.0)
|
74
|
+
rspec-core (2.14.5)
|
75
|
+
rspec-expectations (2.14.2)
|
76
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
77
|
+
rspec-mocks (2.14.3)
|
78
|
+
rspec-rails (2.14.0)
|
79
|
+
actionpack (>= 3.0)
|
80
|
+
activesupport (>= 3.0)
|
81
|
+
railties (>= 3.0)
|
82
|
+
rspec-core (~> 2.14.0)
|
83
|
+
rspec-expectations (~> 2.14.0)
|
84
|
+
rspec-mocks (~> 2.14.0)
|
85
|
+
slim (2.0.1)
|
86
|
+
temple (~> 0.6.6)
|
87
|
+
tilt (>= 1.3.3, < 2.1)
|
88
|
+
slim-rails (2.0.1)
|
89
|
+
actionpack (>= 3.0, < 4.1)
|
90
|
+
activesupport (>= 3.0, < 4.1)
|
91
|
+
railties (>= 3.0, < 4.1)
|
92
|
+
slim (~> 2.0)
|
93
|
+
sprockets (2.10.1)
|
94
|
+
hike (~> 1.2)
|
95
|
+
multi_json (~> 1.0)
|
96
|
+
rack (~> 1.0)
|
97
|
+
tilt (~> 1.1, != 1.3.0)
|
98
|
+
sprockets-rails (2.0.1)
|
99
|
+
actionpack (>= 3.0)
|
100
|
+
activesupport (>= 3.0)
|
101
|
+
sprockets (~> 2.8)
|
102
|
+
temple (0.6.6)
|
103
|
+
thor (0.18.1)
|
104
|
+
thread_safe (0.1.2)
|
105
|
+
atomic
|
106
|
+
tilt (1.4.1)
|
107
|
+
treetop (1.4.15)
|
108
|
+
polyglot
|
109
|
+
polyglot (>= 0.3.1)
|
110
|
+
tzinfo (0.3.37)
|
111
|
+
wepay (0.0.1)
|
112
|
+
|
113
|
+
PLATFORMS
|
114
|
+
ruby
|
115
|
+
|
116
|
+
DEPENDENCIES
|
117
|
+
catarse_wepay!
|
118
|
+
database_cleaner
|
119
|
+
factory_girl_rails
|
120
|
+
pg
|
121
|
+
rspec-rails (~> 2.14.0)
|
122
|
+
slim-rails
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 Rafael Lima
|
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.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# CatarseWePay [](https://travis-ci.org/rafaelp/catarse_wepay)
|
2
|
+
|
3
|
+
Catarse WePay express integration with [Catarse](http://github.com/catarse/catarse) crowdfunding platform
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this lines to your Catarse application's Gemfile:
|
8
|
+
|
9
|
+
gem 'catarse_wepay'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Configure the routes for your Catarse application. Add the following lines in the routes file (config/routes.rb):
|
18
|
+
|
19
|
+
mount CatarseWepay::Engine => "/", :as => "catarse_wepay"
|
20
|
+
|
21
|
+
### Configurations
|
22
|
+
|
23
|
+
Create this configurations into Catarse database:
|
24
|
+
|
25
|
+
wepay_client_id, wepay_client_secret, wepay_access_token and wepay_account_id
|
26
|
+
|
27
|
+
In Rails console, run this:
|
28
|
+
|
29
|
+
Configuration.create!(name: "wepay_client_id", value: "999999")
|
30
|
+
Configuration.create!(name: "wepay_client_secret", value: "xxxxxxxxxx")
|
31
|
+
Configuration.create!(name: "wepay_access_token", value: "STAGE_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
|
32
|
+
Configuration.create!(name: "wepay_account_id", value: "999999999")
|
33
|
+
|
34
|
+
## Development environment setup
|
35
|
+
|
36
|
+
Clone the repository:
|
37
|
+
|
38
|
+
$ git clone git://github.com/rafaelp/catarse_wepay.git
|
39
|
+
|
40
|
+
Add the catarse code into test/dummy:
|
41
|
+
|
42
|
+
$ git submodule init
|
43
|
+
$ git submodule update
|
44
|
+
|
45
|
+
And then execute:
|
46
|
+
|
47
|
+
$ bundle
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
1. Fork it
|
52
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
53
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
54
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
55
|
+
5. Create new Pull Request
|
56
|
+
|
57
|
+
## Credits
|
58
|
+
|
59
|
+
CatarseWePay was forked from [catarse_paypal_express](https://github.com/catarse/catarse_paypal_express) and written by [Rafael Lima](http://rafael.adm.br).
|
60
|
+
|
61
|
+
## License
|
62
|
+
|
63
|
+
CatarseWePay is Copyright © 2014 Rafael Lima. It is free software, and may be redistributed under the terms specified in the [MIT-LICENSE](https://github.com/rafaelp/catarse_wepay/blob/master/MIT-LICENSE) file.
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'CatarseWepay'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
Bundler::GemHelper.install_tasks
|
24
|
+
|
25
|
+
require 'rspec/core'
|
26
|
+
require 'rspec/core/rake_task'
|
27
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
28
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
29
|
+
end
|
30
|
+
|
31
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
32
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
33
|
+
spec.rcov = true
|
34
|
+
end
|
35
|
+
|
36
|
+
task :default => :spec
|
@@ -0,0 +1,18 @@
|
|
1
|
+
App.addChild('WePayForm', _.extend({
|
2
|
+
el: '#catarse_wepay_form',
|
3
|
+
|
4
|
+
events: {
|
5
|
+
'click input[type=submit]': 'onSubmitToWePay',
|
6
|
+
},
|
7
|
+
|
8
|
+
activate: function() {
|
9
|
+
this.loader = $('.loader');
|
10
|
+
this.parent.contributionId = $('input#contribution_id').val();
|
11
|
+
this.parent.projectId = $('input#project_id').val();
|
12
|
+
},
|
13
|
+
|
14
|
+
onSubmitToWePay: function(e) {
|
15
|
+
$(e.currentTarget).hide();
|
16
|
+
this.loader.show();
|
17
|
+
}
|
18
|
+
}, window.WePay.UserDocument));
|
File without changes
|
@@ -0,0 +1,105 @@
|
|
1
|
+
class CatarseWepay::WepayController < ApplicationController
|
2
|
+
skip_before_filter :force_http
|
3
|
+
SCOPE = "projects.contributions.checkout"
|
4
|
+
layout :false
|
5
|
+
|
6
|
+
def review
|
7
|
+
end
|
8
|
+
|
9
|
+
def refund
|
10
|
+
response = gateway.call('/checkout/refund', PaymentEngines.configuration[:wepay_access_token], {
|
11
|
+
account_id: PaymentEngines.configuration[:wepay_account_id],
|
12
|
+
checkout_id: contribution.payment_token,
|
13
|
+
refund_reason: t('wepay_refund_reason', scope: SCOPE),
|
14
|
+
})
|
15
|
+
|
16
|
+
if response['state'] == 'refunded'
|
17
|
+
flash[:notice] = I18n.t('projects.contributions.refund.success')
|
18
|
+
else
|
19
|
+
flash[:alert] = refund_request.try(:message) || I18n.t('projects.contributions.refund.error')
|
20
|
+
end
|
21
|
+
|
22
|
+
redirect_to main_app.admin_backers_path
|
23
|
+
end
|
24
|
+
|
25
|
+
def ipn
|
26
|
+
if contribution && (contribution.payment_method == 'WePay' || contribution.payment_method.nil?)
|
27
|
+
response = gateway.call('/checkout', PaymentEngines.configuration[:wepay_access_token], {
|
28
|
+
checkout_id: contribution.payment_token,
|
29
|
+
})
|
30
|
+
PaymentEngines.create_payment_notification backer_id: contribution.id, extra_data: response
|
31
|
+
if response["state"]
|
32
|
+
case response["state"].downcase
|
33
|
+
when 'captured'
|
34
|
+
contribution.confirm!
|
35
|
+
when 'refunded'
|
36
|
+
contribution.refund!
|
37
|
+
when 'cancelled'
|
38
|
+
contribution.cancel!
|
39
|
+
when 'expired', 'failed'
|
40
|
+
contribution.pendent!
|
41
|
+
when 'authorized', 'reserved'
|
42
|
+
contribution.waiting! if contribution.pending?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
contribution.update_attributes({
|
46
|
+
:payment_service_fee => response['fee'],
|
47
|
+
:payer_email => response['payer_email']
|
48
|
+
})
|
49
|
+
else
|
50
|
+
return render status: 500, nothing: true
|
51
|
+
end
|
52
|
+
return render status: 200, nothing: true
|
53
|
+
rescue Exception => e
|
54
|
+
return render status: 500, text: e.inspect
|
55
|
+
end
|
56
|
+
|
57
|
+
def pay
|
58
|
+
response = gateway.call('/checkout/create', PaymentEngines.configuration[:wepay_access_token], {
|
59
|
+
account_id: PaymentEngines.configuration[:wepay_account_id],
|
60
|
+
amount: (contribution.price_in_cents/100).round(2).to_s,
|
61
|
+
short_description: t('wepay_description', scope: SCOPE, :project_name => contribution.project.name, :value => contribution.display_value),
|
62
|
+
type: 'DONATION',
|
63
|
+
redirect_uri: success_wepay_url(id: contribution.id),
|
64
|
+
callback_uri: ipn_wepay_index_url(callback_uri_params)
|
65
|
+
})
|
66
|
+
if response['checkout_uri']
|
67
|
+
contribution.update_attributes payment_method: 'WePay', payment_token: response['checkout_id']
|
68
|
+
redirect_to response['checkout_uri']
|
69
|
+
else
|
70
|
+
flash[:failure] = t('wepay_error', scope: SCOPE)
|
71
|
+
return redirect_to main_app.edit_project_backer_path(project_id: contribution.project.id, id: contribution.id)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def callback_uri_params
|
76
|
+
{host: '52966c09.ngrok.com', port: 80} if Rails.env.development?
|
77
|
+
end
|
78
|
+
|
79
|
+
def success
|
80
|
+
response = gateway.call('/checkout', PaymentEngines.configuration[:wepay_access_token], {
|
81
|
+
checkout_id: contribution.payment_token,
|
82
|
+
})
|
83
|
+
if response['state'] == 'authorized'
|
84
|
+
flash[:success] = t('success', scope: SCOPE)
|
85
|
+
redirect_to main_app.project_backer_path(project_id: contribution.project.id, id: contribution.id)
|
86
|
+
else
|
87
|
+
flash[:failure] = t('wepay_error', scope: SCOPE)
|
88
|
+
redirect_to main_app.new_project_backer_path(contribution.project)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def contribution
|
93
|
+
@contribution ||= if params['id']
|
94
|
+
PaymentEngines.find_payment(id: params['id'])
|
95
|
+
elsif params['checkout_id']
|
96
|
+
PaymentEngines.find_payment(payment_token: params['checkout_id'])
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def gateway
|
101
|
+
raise "[WePay] An API Client ID and Client Secret are required to make requests to WePay" unless PaymentEngines.configuration[:wepay_client_id] and PaymentEngines.configuration[:wepay_client_secret]
|
102
|
+
@gateway ||= WePay.new(PaymentEngines.configuration[:wepay_client_id], PaymentEngines.configuration[:wepay_client_secret])
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
= javascript_include_tag 'catarse_wepay'
|
2
|
+
|
3
|
+
h3= t('projects.contributions.review.international.section_title')
|
4
|
+
|
5
|
+
#catarse_wepay_form
|
6
|
+
= form_tag pay_wepay_path(params[:id]) do
|
7
|
+
.clearfix
|
8
|
+
.bootstrap-twitter
|
9
|
+
.loader.hide= image_tag 'loading.gif'
|
10
|
+
= submit_tag t('projects.contributions.review.international.button'), :class => 'btn btn-primary btn-large'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
# Maintain your gem's version:
|
5
|
+
require "catarse_wepay/version"
|
6
|
+
|
7
|
+
# Describe your gem and declare its dependencies:
|
8
|
+
Gem::Specification.new do |s|
|
9
|
+
s.name = "catarse_wepay"
|
10
|
+
s.version = CatarseWepay::VERSION
|
11
|
+
s.authors = ["Rafael Lima"]
|
12
|
+
s.email = ["contato@rafael.adm.br"]
|
13
|
+
s.homepage = "http://github.com/rafaelp/catarse_wepay"
|
14
|
+
s.summary = "Wepay integration with Catarse"
|
15
|
+
s.description = "Wepay integration with Catarse crowdfunding platform"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split($\)
|
18
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
19
|
+
|
20
|
+
s.add_dependency "rails", "~> 4.0"
|
21
|
+
s.add_dependency "slim-rails"
|
22
|
+
s.add_dependency "wepay", "0.0.1"
|
23
|
+
|
24
|
+
s.add_development_dependency "rspec-rails", '~> 2.14.0'
|
25
|
+
s.add_development_dependency "factory_girl_rails"
|
26
|
+
s.add_development_dependency "database_cleaner"
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
begin
|
2
|
+
PaymentEngines.register({
|
3
|
+
name: 'wepay',
|
4
|
+
review_path: ->(contribution) {
|
5
|
+
CatarseWepay::Engine.routes.url_helpers.review_wepay_path(contribution)
|
6
|
+
},
|
7
|
+
refund_path: ->(contribution) {
|
8
|
+
CatarseWepay::Engine.routes.url_helpers.refund_wepay_path(contribution)
|
9
|
+
},
|
10
|
+
locale: 'en'
|
11
|
+
})
|
12
|
+
rescue Exception => e
|
13
|
+
puts "Error while registering payment engine: #{e}"
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
en:
|
2
|
+
projects:
|
3
|
+
contributions:
|
4
|
+
refund:
|
5
|
+
success: 'Pedido de reembolso enviado com sucesso!'
|
6
|
+
error: 'OPS! Ocorreu um erro ao tentar enviar o pedido de reembolso.'
|
7
|
+
review:
|
8
|
+
wepay: 'WePay'
|
9
|
+
international:
|
10
|
+
section_title: 'You will be directed to the WePay site to complete payment.'
|
11
|
+
button: 'Redirect to WePay'
|
12
|
+
checkout:
|
13
|
+
wepay_cancel: "Your WePay payment was canceled. Please try again."
|
14
|
+
wepay_description: "Back project %{project_name}"
|
15
|
+
wepay_error: "Ooops. There was an error while sending your payment to WePay. Please try again."
|
16
|
+
success: "Your back was successfully made. Thanks a lot!"
|
17
|
+
wepay_refund_reason: "The customer changed his mind"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
pt:
|
2
|
+
projects:
|
3
|
+
contributions:
|
4
|
+
refund:
|
5
|
+
success: 'Pedido de reembolso enviado com sucesso!'
|
6
|
+
error: 'OPS! Ocorreu um erro ao tentar enviar o pedido de reembolso.'
|
7
|
+
review:
|
8
|
+
wepay: 'Pagamento internacional - WePay'
|
9
|
+
international:
|
10
|
+
section_title: 'Você será direcionado para o site do WePay para completar o pagamento.'
|
11
|
+
button: 'Ir para o wepay'
|
12
|
+
checkout:
|
13
|
+
wepay_cancel: "Seu pagamento no WePay foi cancelado. Por favor, tente novamente."
|
14
|
+
wepay_description: "Apoio para o projeto %{project_name}"
|
15
|
+
wepay_error: "Ooops. Ocorreu um erro ao enviar seu pagamento para o WePay. Por favor, tente novamente."
|
16
|
+
success: "Seu apoio foi realizado com sucesso. Muito obrigado!"
|
17
|
+
wepay_refund_reason: "O cliente mudou de ideia"
|
18
|
+
|
data/config/routes.rb
ADDED
data/script/rails
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/catarse_wepay/engine', __FILE__)
|
6
|
+
|
7
|
+
require 'rails/all'
|
8
|
+
require 'rails/engine/commands'
|
9
|
+
|