catarse_iugu 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +171 -0
- data/MIT-LICENSE +20 -0
- data/README.md +48 -0
- data/Rakefile +36 -0
- data/app/.DS_Store +0 -0
- data/app/assets/javascripts/catarse_iugu.js +23 -0
- data/app/assets/stylesheets/catarse_iugu.scss +164 -0
- data/app/controllers/catarse_iugu/iugu_controller.rb +53 -0
- data/app/views/catarse_iugu/iugu/review.html.slim +28 -0
- data/catarse_iugu.gemspec +27 -0
- data/config/initializers/iugu.rb +1 -0
- data/config/routes.rb +10 -0
- data/lib/catarse_iugu.rb +6 -0
- data/lib/catarse_iugu/engine.rb +5 -0
- data/lib/catarse_iugu/payment_engine.rb +19 -0
- data/lib/catarse_iugu/version.rb +3 -0
- data/public/.DS_Store +0 -0
- data/script/rails +8 -0
- data/test/.DS_Store +0 -0
- metadata +165 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f0dd27a4822de6473311db8e3068a7f9c9131a8e
|
4
|
+
data.tar.gz: aaf1329711415ca2f2cbddad48783c6d81bb9ad1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e3ee211c9fd184606496111dd98eb48f5b26ceed3dc7c529d2e8fc872ea637450f111687706ca77126ca4ba2312e356c091d90fb6be47ef5c6f7b068c34f6911
|
7
|
+
data.tar.gz: 8279fc61a941c78ba37922802653fd6907f18b016594e50118252f239fa46e760bb3b3384ba0cb9d3599d32314d98ddbf80ab28d47fe3164617d7af3fa5307d2
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
catarse_iugu
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.2
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
catarse_iugu (0.1)
|
5
|
+
iugu
|
6
|
+
rails (~> 4.1)
|
7
|
+
slim-rails
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
actionmailer (4.2.6)
|
13
|
+
actionpack (= 4.2.6)
|
14
|
+
actionview (= 4.2.6)
|
15
|
+
activejob (= 4.2.6)
|
16
|
+
mail (~> 2.5, >= 2.5.4)
|
17
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
18
|
+
actionpack (4.2.6)
|
19
|
+
actionview (= 4.2.6)
|
20
|
+
activesupport (= 4.2.6)
|
21
|
+
rack (~> 1.6)
|
22
|
+
rack-test (~> 0.6.2)
|
23
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
24
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
25
|
+
actionview (4.2.6)
|
26
|
+
activesupport (= 4.2.6)
|
27
|
+
builder (~> 3.1)
|
28
|
+
erubis (~> 2.7.0)
|
29
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
30
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
31
|
+
activejob (4.2.6)
|
32
|
+
activesupport (= 4.2.6)
|
33
|
+
globalid (>= 0.3.0)
|
34
|
+
activemodel (4.2.6)
|
35
|
+
activesupport (= 4.2.6)
|
36
|
+
builder (~> 3.1)
|
37
|
+
activerecord (4.2.6)
|
38
|
+
activemodel (= 4.2.6)
|
39
|
+
activesupport (= 4.2.6)
|
40
|
+
arel (~> 6.0)
|
41
|
+
activesupport (4.2.6)
|
42
|
+
i18n (~> 0.7)
|
43
|
+
json (~> 1.7, >= 1.7.7)
|
44
|
+
minitest (~> 5.1)
|
45
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
46
|
+
tzinfo (~> 1.1)
|
47
|
+
arel (6.0.3)
|
48
|
+
builder (3.2.2)
|
49
|
+
coderay (1.1.1)
|
50
|
+
concurrent-ruby (1.0.1)
|
51
|
+
database_cleaner (1.5.1)
|
52
|
+
diff-lcs (1.2.5)
|
53
|
+
domain_name (0.5.20160310)
|
54
|
+
unf (>= 0.0.5, < 1.0.0)
|
55
|
+
erubis (2.7.0)
|
56
|
+
factory_girl (4.7.0)
|
57
|
+
activesupport (>= 3.0.0)
|
58
|
+
factory_girl_rails (4.7.0)
|
59
|
+
factory_girl (~> 4.7.0)
|
60
|
+
railties (>= 3.0.0)
|
61
|
+
globalid (0.3.6)
|
62
|
+
activesupport (>= 4.1.0)
|
63
|
+
http-cookie (1.0.2)
|
64
|
+
domain_name (~> 0.5)
|
65
|
+
i18n (0.7.0)
|
66
|
+
iugu (1.0.8)
|
67
|
+
rest-client
|
68
|
+
json (1.8.3)
|
69
|
+
loofah (2.0.3)
|
70
|
+
nokogiri (>= 1.5.9)
|
71
|
+
mail (2.6.4)
|
72
|
+
mime-types (>= 1.16, < 4)
|
73
|
+
method_source (0.8.2)
|
74
|
+
mime-types (2.99.1)
|
75
|
+
mini_portile2 (2.0.0)
|
76
|
+
minitest (5.8.4)
|
77
|
+
netrc (0.11.0)
|
78
|
+
nokogiri (1.6.7.2)
|
79
|
+
mini_portile2 (~> 2.0.0.rc2)
|
80
|
+
pry (0.10.3)
|
81
|
+
coderay (~> 1.1.0)
|
82
|
+
method_source (~> 0.8.1)
|
83
|
+
slop (~> 3.4)
|
84
|
+
rack (1.6.4)
|
85
|
+
rack-test (0.6.3)
|
86
|
+
rack (>= 1.0)
|
87
|
+
rails (4.2.6)
|
88
|
+
actionmailer (= 4.2.6)
|
89
|
+
actionpack (= 4.2.6)
|
90
|
+
actionview (= 4.2.6)
|
91
|
+
activejob (= 4.2.6)
|
92
|
+
activemodel (= 4.2.6)
|
93
|
+
activerecord (= 4.2.6)
|
94
|
+
activesupport (= 4.2.6)
|
95
|
+
bundler (>= 1.3.0, < 2.0)
|
96
|
+
railties (= 4.2.6)
|
97
|
+
sprockets-rails
|
98
|
+
rails-deprecated_sanitizer (1.0.3)
|
99
|
+
activesupport (>= 4.2.0.alpha)
|
100
|
+
rails-dom-testing (1.0.7)
|
101
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
102
|
+
nokogiri (~> 1.6.0)
|
103
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
104
|
+
rails-html-sanitizer (1.0.3)
|
105
|
+
loofah (~> 2.0)
|
106
|
+
railties (4.2.6)
|
107
|
+
actionpack (= 4.2.6)
|
108
|
+
activesupport (= 4.2.6)
|
109
|
+
rake (>= 0.8.7)
|
110
|
+
thor (>= 0.18.1, < 2.0)
|
111
|
+
rake (11.1.2)
|
112
|
+
rest-client (1.8.0)
|
113
|
+
http-cookie (>= 1.0.2, < 2.0)
|
114
|
+
mime-types (>= 1.16, < 3.0)
|
115
|
+
netrc (~> 0.7)
|
116
|
+
rspec-core (3.4.4)
|
117
|
+
rspec-support (~> 3.4.0)
|
118
|
+
rspec-expectations (3.4.0)
|
119
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
120
|
+
rspec-support (~> 3.4.0)
|
121
|
+
rspec-mocks (3.4.1)
|
122
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
123
|
+
rspec-support (~> 3.4.0)
|
124
|
+
rspec-rails (3.4.2)
|
125
|
+
actionpack (>= 3.0, < 4.3)
|
126
|
+
activesupport (>= 3.0, < 4.3)
|
127
|
+
railties (>= 3.0, < 4.3)
|
128
|
+
rspec-core (~> 3.4.0)
|
129
|
+
rspec-expectations (~> 3.4.0)
|
130
|
+
rspec-mocks (~> 3.4.0)
|
131
|
+
rspec-support (~> 3.4.0)
|
132
|
+
rspec-support (3.4.1)
|
133
|
+
slim (3.0.6)
|
134
|
+
temple (~> 0.7.3)
|
135
|
+
tilt (>= 1.3.3, < 2.1)
|
136
|
+
slim-rails (3.0.1)
|
137
|
+
actionmailer (>= 3.1, < 5.0)
|
138
|
+
actionpack (>= 3.1, < 5.0)
|
139
|
+
activesupport (>= 3.1, < 5.0)
|
140
|
+
railties (>= 3.1, < 5.0)
|
141
|
+
slim (~> 3.0)
|
142
|
+
slop (3.6.0)
|
143
|
+
sprockets (3.6.0)
|
144
|
+
concurrent-ruby (~> 1.0)
|
145
|
+
rack (> 1, < 3)
|
146
|
+
sprockets-rails (3.0.4)
|
147
|
+
actionpack (>= 4.0)
|
148
|
+
activesupport (>= 4.0)
|
149
|
+
sprockets (>= 3.0.0)
|
150
|
+
temple (0.7.6)
|
151
|
+
thor (0.19.1)
|
152
|
+
thread_safe (0.3.5)
|
153
|
+
tilt (2.0.2)
|
154
|
+
tzinfo (1.2.2)
|
155
|
+
thread_safe (~> 0.1)
|
156
|
+
unf (0.1.4)
|
157
|
+
unf_ext
|
158
|
+
unf_ext (0.0.7.2)
|
159
|
+
|
160
|
+
PLATFORMS
|
161
|
+
ruby
|
162
|
+
|
163
|
+
DEPENDENCIES
|
164
|
+
catarse_iugu!
|
165
|
+
database_cleaner
|
166
|
+
factory_girl_rails
|
167
|
+
pry
|
168
|
+
rspec-rails
|
169
|
+
|
170
|
+
BUNDLED WITH
|
171
|
+
1.11.2
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 Lvxn0va
|
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,48 @@
|
|
1
|
+
# CatarseIugu v. 0.1
|
2
|
+
|
3
|
+
Iugu integration with [Catarse](http://github.com/danielweinmann/catarse) crowdfunding platform.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this lines to your Catarse application's Gemfile under the payments section:
|
8
|
+
|
9
|
+
gem 'catarse_stripe', :git => 'git://github.com/mrodrigues/catarse_iugu.git'
|
10
|
+
gem 'iugu', :git => 'https://github.com/iugu/iugu-ruby.git'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
Configure the routes for your Catarse application. Add the following lines in the routes file (config/routes.rb):
|
19
|
+
|
20
|
+
mount CatarseIugu::Engine => "/", :as => "catarse_iugu"
|
21
|
+
|
22
|
+
### Configurations
|
23
|
+
|
24
|
+
|
25
|
+
### Authorization
|
26
|
+
|
27
|
+
## Development environment setup
|
28
|
+
|
29
|
+
Clone the repository:
|
30
|
+
|
31
|
+
$ git clone git://github.com/mrodrigues/catarse_iugu.git
|
32
|
+
|
33
|
+
And then execute:
|
34
|
+
|
35
|
+
$ bundle
|
36
|
+
|
37
|
+
## Troubleshooting in development environment
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
1. Fork it
|
42
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
45
|
+
5. Create new Pull Request
|
46
|
+
|
47
|
+
|
48
|
+
This project rocks and uses MIT-LICENSE.
|
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 = 'CatarseStripe'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
Bundler::GemHelper.install_tasks
|
25
|
+
|
26
|
+
require 'rake/testtask'
|
27
|
+
|
28
|
+
Rake::TestTask.new(:test) do |t|
|
29
|
+
t.libs << 'lib'
|
30
|
+
t.libs << 'test'
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
32
|
+
t.verbose = false
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
task :default => :test
|
data/app/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$(window).bind("load", function() {
|
2
|
+
Iugu.setAccountID("671e7c16-950b-4de4-9b29-2f441d66cd2c");
|
3
|
+
Iugu.setTestMode(true);
|
4
|
+
Iugu.setup();
|
5
|
+
});
|
6
|
+
|
7
|
+
jQuery(function($) {
|
8
|
+
$('#catarse_iugu_form').submit(function submitIuguForm(evt) {
|
9
|
+
var form = $(this);
|
10
|
+
Iugu.createPaymentToken(this, tokenResponseHandler);
|
11
|
+
return false;
|
12
|
+
|
13
|
+
function tokenResponseHandler(data) {
|
14
|
+
if (data.errors) {
|
15
|
+
// console.log(data.errors);
|
16
|
+
alert("Erro salvando cartão: " + JSON.stringify(data.errors));
|
17
|
+
} else {
|
18
|
+
$("#token").val( data.id );
|
19
|
+
form.get(0).submit();
|
20
|
+
}
|
21
|
+
}
|
22
|
+
});
|
23
|
+
});
|
@@ -0,0 +1,164 @@
|
|
1
|
+
/* Credit Card Form */
|
2
|
+
.usable-creditcard-form, .usable-creditcard-form * {
|
3
|
+
font-size: 13px;
|
4
|
+
}
|
5
|
+
.usable-creditcard-form {
|
6
|
+
position: relative;
|
7
|
+
padding: 0px;
|
8
|
+
width: 300px;
|
9
|
+
margin-left: auto;
|
10
|
+
margin-right: auto;
|
11
|
+
}
|
12
|
+
.usable-creditcard-form .wrapper {
|
13
|
+
border: 1px solid #CCC;
|
14
|
+
border-top: 1px solid #AAA;
|
15
|
+
border-right: 1px solid #AAA;
|
16
|
+
height: 74px;
|
17
|
+
width: 300px;
|
18
|
+
position: relative;
|
19
|
+
-webkit-border-radius: 5px;
|
20
|
+
-moz-border-radius: 5px;
|
21
|
+
border-radius: 5px;
|
22
|
+
}
|
23
|
+
.usable-creditcard-form .input-group {
|
24
|
+
position: absolute;
|
25
|
+
top: 300px;
|
26
|
+
}
|
27
|
+
.usable-creditcard-form .input-group.nmb_a {
|
28
|
+
position: absolute;
|
29
|
+
width: 200px;
|
30
|
+
top: 0px;
|
31
|
+
left: 0px;
|
32
|
+
}
|
33
|
+
.usable-creditcard-form .input-group.nmb_b {
|
34
|
+
position: absolute;
|
35
|
+
width: 100px;
|
36
|
+
top: 0px;
|
37
|
+
right: 0px;
|
38
|
+
}
|
39
|
+
.usable-creditcard-form .input-group.nmb_b input,
|
40
|
+
.usable-creditcard-form .input-group.nmb_d input {
|
41
|
+
text-align: center;
|
42
|
+
}
|
43
|
+
.usable-creditcard-form .input-group.nmb_c {
|
44
|
+
position: absolute;
|
45
|
+
width: 200px;
|
46
|
+
top: 37px;
|
47
|
+
left: 0px;
|
48
|
+
}
|
49
|
+
.usable-creditcard-form .input-group.nmb_d {
|
50
|
+
position: absolute;
|
51
|
+
width: 100px;
|
52
|
+
top: 37px;
|
53
|
+
right: 0px;
|
54
|
+
}
|
55
|
+
.usable-creditcard-form input {
|
56
|
+
background: none;
|
57
|
+
display: block;
|
58
|
+
width: 100%;
|
59
|
+
padding: 10px;
|
60
|
+
-moz-box-sizing: border-box;
|
61
|
+
-webkit-box-sizing: border-box;
|
62
|
+
box-sizing: border-box;
|
63
|
+
margin:0px;
|
64
|
+
padding-left: 35px;
|
65
|
+
border: none;
|
66
|
+
}
|
67
|
+
.usable-creditcard-form .input-group .icon {
|
68
|
+
position: absolute;
|
69
|
+
width: 22px;
|
70
|
+
height: 22px;
|
71
|
+
background: #CCC;
|
72
|
+
left: 8px;
|
73
|
+
top: 7px;
|
74
|
+
}
|
75
|
+
.usable-creditcard-form .input-group.nmb_a input {
|
76
|
+
border-right: 1px solid #ECECEC;
|
77
|
+
}
|
78
|
+
.usable-creditcard-form .input-group.nmb_c input {
|
79
|
+
border-top: 1px solid #ECECEC;
|
80
|
+
border-right: 1px solid #ECECEC;
|
81
|
+
}
|
82
|
+
|
83
|
+
.usable-creditcard-form input::-webkit-input-placeholder {
|
84
|
+
font-size: 12px;
|
85
|
+
text-transform: none;
|
86
|
+
}
|
87
|
+
.usable-creditcard-form .input-group.nmb_d input {
|
88
|
+
border-top: 1px solid #ECECEC;
|
89
|
+
}
|
90
|
+
|
91
|
+
.usable-creditcard-form .input-group.nmb_c input {
|
92
|
+
text-transform: uppercase;
|
93
|
+
}
|
94
|
+
.usable-creditcard-form .accept {
|
95
|
+
color: #999;
|
96
|
+
font-size: 11px;
|
97
|
+
margin-bottom: 5px;
|
98
|
+
}
|
99
|
+
.usable-creditcard-form .footer {
|
100
|
+
margin-top: 3px;
|
101
|
+
position: relative;
|
102
|
+
margin-left: 5px;
|
103
|
+
margin-right: 5px;
|
104
|
+
}
|
105
|
+
.usable-creditcard-form .footer img {
|
106
|
+
padding: 0px;
|
107
|
+
margin: 0px;
|
108
|
+
}
|
109
|
+
.usable-creditcard-form .iugu-btn {
|
110
|
+
position: absolute;
|
111
|
+
top: 0px;
|
112
|
+
right: 0px;
|
113
|
+
}
|
114
|
+
|
115
|
+
/* Do not forget to store your images in a secure server */
|
116
|
+
.usable-creditcard-form .input-group .icon.ccic-name {
|
117
|
+
background: url("http://storage.pupui.com.br/9CA0F40E971643D1B7C8DE46BBC18396/assets/ccic-name.1cafa1882fdd56f8425de54a5a5bbd1e.png") no-repeat;
|
118
|
+
}
|
119
|
+
.usable-creditcard-form .input-group .icon.ccic-exp {
|
120
|
+
background: url("http://storage.pupui.com.br/9CA0F40E971643D1B7C8DE46BBC18396/assets/ccic-exp.05e708b1489d5e00c871f20ba33bbff3.png") no-repeat;
|
121
|
+
}
|
122
|
+
.usable-creditcard-form .input-group .icon.ccic-brand {
|
123
|
+
background: url("http://storage.pupui.com.br/9CA0F40E971643D1B7C8DE46BBC18396/assets/ccic-brands.48dba03883007f86e118f683dcfc4297.png") no-repeat;
|
124
|
+
}
|
125
|
+
.usable-creditcard-form .input-group .icon.ccic-cvv { background: url("http://storage.pupui.com.br/9CA0F40E971643D1B7C8DE46BBC18396/assets/ccic-cvv.1fe78dcc390427094bdc14dedea10f34.png") no-repeat; }
|
126
|
+
|
127
|
+
.usable-creditcard-form .input-group .icon.ccic-cvv,
|
128
|
+
.usable-creditcard-form .input-group .icon.ccic-brand
|
129
|
+
{
|
130
|
+
-webkit-transition:background-position .2s ease-in;
|
131
|
+
-moz-transition:background-position .2s ease-in;
|
132
|
+
-o-transition:background-position .2s ease-in;
|
133
|
+
transition:background-position .2s ease-in;
|
134
|
+
}
|
135
|
+
|
136
|
+
.amex .usable-creditcard-form .input-group .icon.ccic-cvv {
|
137
|
+
background-position: 0px -22px;
|
138
|
+
}
|
139
|
+
|
140
|
+
.amex .usable-creditcard-form .input-group .icon.ccic-brand {
|
141
|
+
background-position: 0px -110px;
|
142
|
+
}
|
143
|
+
|
144
|
+
.visa .usable-creditcard-form .input-group .icon.ccic-brand {
|
145
|
+
background-position: 0px -22px;
|
146
|
+
}
|
147
|
+
|
148
|
+
.diners .usable-creditcard-form .input-group .icon.ccic-brand {
|
149
|
+
background-position: 0px -88px;
|
150
|
+
}
|
151
|
+
|
152
|
+
.mastercard .usable-creditcard-form .input-group .icon.ccic-brand {
|
153
|
+
background-position: 0px -66px;
|
154
|
+
}
|
155
|
+
|
156
|
+
/* Non Credit Card Form - Token Area */
|
157
|
+
.token-area {
|
158
|
+
margin-top: 20px;
|
159
|
+
margin-bottom: 20px;
|
160
|
+
border: 1px dotted #CCC;
|
161
|
+
display: block;
|
162
|
+
padding: 20px;
|
163
|
+
background: #EFEFEF;
|
164
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class CatarseIugu::IuguController < ApplicationController
|
2
|
+
layout false
|
3
|
+
|
4
|
+
def review
|
5
|
+
contribution
|
6
|
+
end
|
7
|
+
|
8
|
+
def pay
|
9
|
+
begin
|
10
|
+
payment.save!
|
11
|
+
charge = Iugu::Charge.create(
|
12
|
+
"token" => params[:token],
|
13
|
+
"email" => contribution.payer_email,
|
14
|
+
"items" => [
|
15
|
+
{
|
16
|
+
"description" => contribution.project.name,
|
17
|
+
"quantity" => "1",
|
18
|
+
"price_cents" => contribution.price_in_cents
|
19
|
+
}
|
20
|
+
]
|
21
|
+
)
|
22
|
+
|
23
|
+
if charge.success
|
24
|
+
flash[:notice] = "Contribuição feita com sucesso!"
|
25
|
+
payment.pay!
|
26
|
+
PaymentEngines.create_payment_notification contribution_id: contribution.id, payment_id: payment.id
|
27
|
+
redirect_to main_app.project_contribution_path(contribution.project, contribution)
|
28
|
+
else
|
29
|
+
flash[:error] = "Houve um erro ao realizar o pagamento."
|
30
|
+
redirect_to main_app.new_project_contribution_path(contribution.project)
|
31
|
+
end
|
32
|
+
rescue Exception => e
|
33
|
+
Rails.logger.info "-----> #{e.inspect}"
|
34
|
+
flash[:failure] = e.message
|
35
|
+
return redirect_to main_app.new_project_contribution_path(contribution.project)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def contribution
|
42
|
+
@contribution ||= PaymentEngines.find_contribution(params[:id])
|
43
|
+
end
|
44
|
+
|
45
|
+
def payment
|
46
|
+
@payment ||= PaymentEngines.new_payment(
|
47
|
+
contribution: contribution,
|
48
|
+
value: contribution.value,
|
49
|
+
gateway: "Iugu",
|
50
|
+
payment_method: 'Iugu'
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
= javascript_include_tag 'https://js.iugu.com/v2', id: 'iugu-script'
|
2
|
+
= javascript_include_tag 'catarse_iugu'
|
3
|
+
= stylesheet_link_tag 'catarse_iugu'
|
4
|
+
|
5
|
+
form#catarse_iugu_form action=(pay_iugu_path(@contribution)) method="POST"
|
6
|
+
.usable-creditcard-form
|
7
|
+
.wrapper
|
8
|
+
.input-group.nmb_a
|
9
|
+
.icon.ccic-brand
|
10
|
+
input.credit_card_number autocomplete="off" data-iugu="number" placeholder=("Número do Cartão") type="text" value="" /
|
11
|
+
.input-group.nmb_b
|
12
|
+
.icon.ccic-cvv
|
13
|
+
input.credit_card_cvv autocomplete="off" data-iugu="verification_value" placeholder="CVV" type="text" value="" /
|
14
|
+
.input-group.nmb_c
|
15
|
+
.icon.ccic-name
|
16
|
+
input.credit_card_name data-iugu="full_name" placeholder=("Titular do Cartão") type="text" value="" /
|
17
|
+
.input-group.nmb_d
|
18
|
+
.icon.ccic-exp
|
19
|
+
input.credit_card_expiration autocomplete="off" data-iugu="expiration" placeholder="MM/AA" type="text" value="" /
|
20
|
+
.footer
|
21
|
+
img alt="Visa, Master, Diners. Amex" border="0" src="http://storage.pupui.com.br/9CA0F40E971643D1B7C8DE46BBC18396/assets/cc-icons.e8f4c6b4db3cc0869fa93ad535acbfe7.png" /
|
22
|
+
a.iugu-btn href="http://iugu.com" tabindex="-1"
|
23
|
+
img alt=("Pagamentos por Iugu") border="0" src="http://storage.pupui.com.br/9CA0F40E971643D1B7C8DE46BBC18396/assets/payments-by-iugu.1df7caaf6958f1b5774579fa807b5e7f.png" /
|
24
|
+
.token-area
|
25
|
+
label for="token" Token do Cartão de Crédito - Enviar para seu Servidor
|
26
|
+
input#token name="token" readonly="true" size="64" style="text-align:center" type="text" value="" /
|
27
|
+
div
|
28
|
+
button type="submit" Salvar
|
@@ -0,0 +1,27 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "catarse_iugu/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "catarse_iugu"
|
9
|
+
s.version = CatarseIugu::VERSION
|
10
|
+
s.authors = ["mrodrigues"]
|
11
|
+
s.email = ["mrodrigues.uff@gmail.com"]
|
12
|
+
s.homepage = "http://github.com/mrodrigues/catarse_iugu"
|
13
|
+
s.summary = "Iugu Payments Integration with Catarse."
|
14
|
+
s.description = "Iugu Payments Integration with Catarse crowdfunding platform."
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split($\)
|
17
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
18
|
+
|
19
|
+
s.add_dependency "rails", "~> 4.1"
|
20
|
+
s.add_dependency "iugu"
|
21
|
+
s.add_dependency "slim-rails"
|
22
|
+
|
23
|
+
s.add_development_dependency "pry"
|
24
|
+
s.add_development_dependency "rspec-rails"
|
25
|
+
s.add_development_dependency "factory_girl_rails"
|
26
|
+
s.add_development_dependency "database_cleaner"
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Iugu.api_key = "b101eaff7163e194aa78170555aa86ab"
|
data/config/routes.rb
ADDED
data/lib/catarse_iugu.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module CatarseIugu
|
2
|
+
class PaymentEngine
|
3
|
+
def name
|
4
|
+
'Iugu'
|
5
|
+
end
|
6
|
+
|
7
|
+
def review_path(contribution)
|
8
|
+
CatarseIugu::Engine.routes.url_helpers.review_iugu_path(contribution)
|
9
|
+
end
|
10
|
+
|
11
|
+
def can_do_refund?
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
def locale
|
16
|
+
'pt-BR'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/public/.DS_Store
ADDED
Binary file
|
data/script/rails
ADDED
@@ -0,0 +1,8 @@
|
|
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_iugu/engine', __FILE__)
|
6
|
+
|
7
|
+
require 'rails/all'
|
8
|
+
require 'rails/engine/commands'
|
data/test/.DS_Store
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: catarse_iugu
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mrodrigues
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: iugu
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: slim-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: factory_girl_rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: database_cleaner
|
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'
|
111
|
+
description: Iugu Payments Integration with Catarse crowdfunding platform.
|
112
|
+
email:
|
113
|
+
- mrodrigues.uff@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".ruby-gemset"
|
120
|
+
- ".ruby-version"
|
121
|
+
- Gemfile
|
122
|
+
- Gemfile.lock
|
123
|
+
- MIT-LICENSE
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- app/.DS_Store
|
127
|
+
- app/assets/javascripts/catarse_iugu.js
|
128
|
+
- app/assets/stylesheets/catarse_iugu.scss
|
129
|
+
- app/controllers/catarse_iugu/iugu_controller.rb
|
130
|
+
- app/views/catarse_iugu/iugu/review.html.slim
|
131
|
+
- catarse_iugu.gemspec
|
132
|
+
- config/initializers/iugu.rb
|
133
|
+
- config/routes.rb
|
134
|
+
- lib/catarse_iugu.rb
|
135
|
+
- lib/catarse_iugu/engine.rb
|
136
|
+
- lib/catarse_iugu/payment_engine.rb
|
137
|
+
- lib/catarse_iugu/version.rb
|
138
|
+
- public/.DS_Store
|
139
|
+
- script/rails
|
140
|
+
- test/.DS_Store
|
141
|
+
homepage: http://github.com/mrodrigues/catarse_iugu
|
142
|
+
licenses: []
|
143
|
+
metadata: {}
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
requirements: []
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 2.4.8
|
161
|
+
signing_key:
|
162
|
+
specification_version: 4
|
163
|
+
summary: Iugu Payments Integration with Catarse.
|
164
|
+
test_files:
|
165
|
+
- test/.DS_Store
|