catarse_iugu 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/catarse_iugu.js +68 -1
- data/app/assets/stylesheets/catarse_iugu.scss +76 -8
- data/app/controllers/catarse_iugu/iugu_controller.rb +2 -2
- data/app/views/catarse_iugu/iugu/review.html.slim +7 -5
- data/lib/catarse_iugu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8d95a037f293e5bcae056bbb0868469ab1192be
|
4
|
+
data.tar.gz: 11b3f07eb5ef021a4369ce78a4b54b125182e0f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19d01c1605baa99d62df0ee2971afa725974c22f2b01d3409f68e229951ef25d5ff5ff2f7195a0e4b0e9299460e288026331d9a41580164f2b4a126932b916b0
|
7
|
+
data.tar.gz: a9953911391a68010763e35cccbb5685f19d719d909dffaa9166445486f2347d59fb1a13e133f9cfab8df346d383318c860aeb9ba3805583d77ead8da850e6d8
|
data/Gemfile.lock
CHANGED
@@ -2,6 +2,8 @@ $(window).bind("load", function() {
|
|
2
2
|
Iugu.setAccountID(IUGU_ACCOUNT_ID);
|
3
3
|
Iugu.setTestMode(true);
|
4
4
|
Iugu.setup();
|
5
|
+
$('#catarse-iugu-loader').addClass('hidden');
|
6
|
+
$('#catarse_iugu_form').removeClass('hidden');
|
5
7
|
});
|
6
8
|
|
7
9
|
jQuery(function($) {
|
@@ -12,11 +14,76 @@ jQuery(function($) {
|
|
12
14
|
|
13
15
|
function tokenResponseHandler(data) {
|
14
16
|
if (data.errors) {
|
15
|
-
|
17
|
+
showErrors(data.errors);
|
16
18
|
} else {
|
17
19
|
$("#token").val( data.id );
|
18
20
|
form.get(0).submit();
|
19
21
|
}
|
20
22
|
}
|
23
|
+
|
24
|
+
function showErrors(errors) {
|
25
|
+
if (errors.number) {
|
26
|
+
$('[data-iugu=number]').addClass('error');
|
27
|
+
}
|
28
|
+
|
29
|
+
if (errors.verification_value) {
|
30
|
+
$('[data-iugu=verification_value]').addClass('error');
|
31
|
+
}
|
32
|
+
|
33
|
+
if (errors.expiration) {
|
34
|
+
$('[data-iugu=expiration]').addClass('error');
|
35
|
+
}
|
36
|
+
|
37
|
+
if (errors.first_name || errors.last_name) {
|
38
|
+
$('[data-iugu=full_name]').addClass('error');
|
39
|
+
}
|
40
|
+
|
41
|
+
$('#iugu-error-messages').html(
|
42
|
+
Object.keys(errors)
|
43
|
+
.map(function toPair(key) {
|
44
|
+
if (!Array.isArray(errors[key])) {
|
45
|
+
return { key: key, errors: [errors[key]] };
|
46
|
+
}
|
47
|
+
return { key: key, errors: errors[key] };
|
48
|
+
})
|
49
|
+
.map(errorMessageFor)
|
50
|
+
.map(toListItem)
|
51
|
+
);
|
52
|
+
}
|
53
|
+
|
54
|
+
function errorMessageFor(error) {
|
55
|
+
var requiredErrors = {
|
56
|
+
first_name: 'Você deve preencher seu primeiro nome',
|
57
|
+
last_name: 'Você deve preencher seu último nome',
|
58
|
+
expiration: 'Você deve preencher a data de expiração do cartão com uma data futura',
|
59
|
+
verification_value: 'Você deve preencher o código de validação do cartão',
|
60
|
+
number: 'Você deve preencher o número do cartão'
|
61
|
+
};
|
62
|
+
|
63
|
+
if (error.errors[0] === 'is_invalid') {
|
64
|
+
return requiredErrors[error.key];
|
65
|
+
}
|
66
|
+
|
67
|
+
switch (error.key) {
|
68
|
+
case 'number':
|
69
|
+
if (error.errors.filter(isEqual("is not a valid credit card number")).length) {
|
70
|
+
return 'O número do cartão não é válido';
|
71
|
+
}
|
72
|
+
break;
|
73
|
+
|
74
|
+
default:
|
75
|
+
throw new Error('Unrecognized error: ', JSON.stringify(error));
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
function toListItem(content) {
|
80
|
+
return '<li>' + content + '</li>';
|
81
|
+
}
|
82
|
+
|
83
|
+
function isEqual(target) {
|
84
|
+
return function delayedIsEqual(element) {
|
85
|
+
return element == target;
|
86
|
+
}
|
87
|
+
}
|
21
88
|
});
|
22
89
|
});
|
@@ -153,12 +153,80 @@
|
|
153
153
|
background-position: 0px -66px;
|
154
154
|
}
|
155
155
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
156
|
+
.error {
|
157
|
+
border: 1px solid red !important;
|
158
|
+
}
|
159
|
+
|
160
|
+
/* Loader */
|
161
|
+
|
162
|
+
.loader {
|
163
|
+
color: #dddddd;
|
164
|
+
font-size: 20px;
|
165
|
+
margin: 100px auto;
|
166
|
+
width: 1em;
|
167
|
+
height: 1em;
|
168
|
+
border-radius: 50%;
|
169
|
+
position: relative;
|
170
|
+
text-indent: -9999em;
|
171
|
+
-webkit-animation: load4 1.3s infinite linear;
|
172
|
+
animation: load4 1.3s infinite linear;
|
173
|
+
-webkit-transform: translateZ(0);
|
174
|
+
-ms-transform: translateZ(0);
|
175
|
+
transform: translateZ(0);
|
176
|
+
}
|
177
|
+
|
178
|
+
@-webkit-keyframes load4 {
|
179
|
+
0%,
|
180
|
+
100% {
|
181
|
+
box-shadow: 0 -3em 0 0.2em, 2em -2em 0 0em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 0;
|
182
|
+
}
|
183
|
+
12.5% {
|
184
|
+
box-shadow: 0 -3em 0 0, 2em -2em 0 0.2em, 3em 0 0 0, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 -1em;
|
185
|
+
}
|
186
|
+
25% {
|
187
|
+
box-shadow: 0 -3em 0 -0.5em, 2em -2em 0 0, 3em 0 0 0.2em, 2em 2em 0 0, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 -1em;
|
188
|
+
}
|
189
|
+
37.5% {
|
190
|
+
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0em 0 0, 2em 2em 0 0.2em, 0 3em 0 0em, -2em 2em 0 -1em, -3em 0em 0 -1em, -2em -2em 0 -1em;
|
191
|
+
}
|
192
|
+
50% {
|
193
|
+
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 0em, 0 3em 0 0.2em, -2em 2em 0 0, -3em 0em 0 -1em, -2em -2em 0 -1em;
|
194
|
+
}
|
195
|
+
62.5% {
|
196
|
+
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 0, -2em 2em 0 0.2em, -3em 0 0 0, -2em -2em 0 -1em;
|
197
|
+
}
|
198
|
+
75% {
|
199
|
+
box-shadow: 0em -3em 0 -1em, 2em -2em 0 -1em, 3em 0em 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 0, -3em 0em 0 0.2em, -2em -2em 0 0;
|
200
|
+
}
|
201
|
+
87.5% {
|
202
|
+
box-shadow: 0em -3em 0 0, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 0, -3em 0em 0 0, -2em -2em 0 0.2em;
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
@keyframes load4 {
|
207
|
+
0%,
|
208
|
+
100% {
|
209
|
+
box-shadow: 0 -3em 0 0.2em, 2em -2em 0 0em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 0;
|
210
|
+
}
|
211
|
+
12.5% {
|
212
|
+
box-shadow: 0 -3em 0 0, 2em -2em 0 0.2em, 3em 0 0 0, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 -1em;
|
213
|
+
}
|
214
|
+
25% {
|
215
|
+
box-shadow: 0 -3em 0 -0.5em, 2em -2em 0 0, 3em 0 0 0.2em, 2em 2em 0 0, 0 3em 0 -1em, -2em 2em 0 -1em, -3em 0 0 -1em, -2em -2em 0 -1em;
|
216
|
+
}
|
217
|
+
37.5% {
|
218
|
+
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0em 0 0, 2em 2em 0 0.2em, 0 3em 0 0em, -2em 2em 0 -1em, -3em 0em 0 -1em, -2em -2em 0 -1em;
|
219
|
+
}
|
220
|
+
50% {
|
221
|
+
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 0em, 0 3em 0 0.2em, -2em 2em 0 0, -3em 0em 0 -1em, -2em -2em 0 -1em;
|
222
|
+
}
|
223
|
+
62.5% {
|
224
|
+
box-shadow: 0 -3em 0 -1em, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 0, -2em 2em 0 0.2em, -3em 0 0 0, -2em -2em 0 -1em;
|
225
|
+
}
|
226
|
+
75% {
|
227
|
+
box-shadow: 0em -3em 0 -1em, 2em -2em 0 -1em, 3em 0em 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 0, -3em 0em 0 0.2em, -2em -2em 0 0;
|
228
|
+
}
|
229
|
+
87.5% {
|
230
|
+
box-shadow: 0em -3em 0 0, 2em -2em 0 -1em, 3em 0 0 -1em, 2em 2em 0 -1em, 0 3em 0 -1em, -2em 2em 0 0, -3em 0em 0 0, -2em -2em 0 0.2em;
|
231
|
+
}
|
164
232
|
}
|
@@ -26,12 +26,12 @@ class CatarseIugu::IuguController < ApplicationController
|
|
26
26
|
PaymentEngines.create_payment_notification contribution_id: contribution.id, payment_id: payment.id
|
27
27
|
redirect_to main_app.project_contribution_path(contribution.project, contribution)
|
28
28
|
else
|
29
|
-
flash[:
|
29
|
+
flash[:notice] = "Houve um erro ao realizar o pagamento: #{charge.message}"
|
30
30
|
redirect_to main_app.new_project_contribution_path(contribution.project)
|
31
31
|
end
|
32
32
|
rescue Exception => e
|
33
33
|
Rails.logger.info "-----> #{e.inspect}"
|
34
|
-
flash[:
|
34
|
+
flash[:notice] = "Houve um erro ao realizar o pagamento: #{e.message}"
|
35
35
|
return redirect_to main_app.new_project_contribution_path(contribution.project)
|
36
36
|
end
|
37
37
|
end
|
@@ -4,7 +4,11 @@ javascript:
|
|
4
4
|
= javascript_include_tag 'catarse_iugu'
|
5
5
|
= stylesheet_link_tag 'catarse_iugu'
|
6
6
|
|
7
|
-
|
7
|
+
#catarse-iugu-loader.loader
|
8
|
+
|
9
|
+
ul#iugu-error-messages
|
10
|
+
|
11
|
+
form#catarse_iugu_form.hidden action=(pay_iugu_path(@contribution)) method="POST"
|
8
12
|
.usable-creditcard-form
|
9
13
|
.wrapper
|
10
14
|
.input-group.nmb_a
|
@@ -23,8 +27,6 @@ form#catarse_iugu_form action=(pay_iugu_path(@contribution)) method="POST"
|
|
23
27
|
img alt="Visa, Master, Diners. Amex" border="0" src="http://storage.pupui.com.br/9CA0F40E971643D1B7C8DE46BBC18396/assets/cc-icons.e8f4c6b4db3cc0869fa93ad535acbfe7.png" /
|
24
28
|
a.iugu-btn href="http://iugu.com" tabindex="-1"
|
25
29
|
img alt=("Pagamentos por Iugu") border="0" src="http://storage.pupui.com.br/9CA0F40E971643D1B7C8DE46BBC18396/assets/payments-by-iugu.1df7caaf6958f1b5774579fa807b5e7f.png" /
|
26
|
-
|
27
|
-
label for="token" Token do Cartão de Crédito - Enviar para seu Servidor
|
28
|
-
input#token name="token" readonly="true" size="64" style="text-align:center" type="text" value="" /
|
30
|
+
input#token name="token" type="hidden" value="" /
|
29
31
|
div
|
30
|
-
button type="submit"
|
32
|
+
button type="submit" Enviar
|
data/lib/catarse_iugu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: catarse_iugu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mrodrigues
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|