catarse_moip 1.0.9 → 2.0.0
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/Gemfile.lock +65 -70
- data/README.md +6 -0
- data/app/assets/javascripts/catarse_moip/moip_form.js +16 -1
- data/app/assets/javascripts/catarse_moip/user_document.js +1 -1
- data/app/controllers/catarse_moip/moip_controller.rb +38 -38
- data/catarse_moip.gemspec +2 -2
- data/config/routes.rb +3 -3
- data/lib/catarse_moip/version.rb +1 -1
- data/spec/controllers/catarse_moip/moip_controller_spec.rb +55 -94
- data/test/dummy/config/application.rb +3 -39
- data/test/dummy/config/environments/development.rb +11 -19
- data/test/dummy/config/environments/production.rb +40 -27
- data/test/dummy/config/environments/test.rb +13 -14
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +6 -5
- data/test/dummy/config/initializers/secret_token.rb +7 -2
- data/test/dummy/config/initializers/session_store.rb +0 -5
- data/test/dummy/config/initializers/wrap_parameters.rb +6 -6
- metadata +10 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a467ec8f386bd6254b46c9052512702d5ef580e
|
|
4
|
+
data.tar.gz: 659e2d260728031a7703deb3ef421033e2ff53a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 290f04967235c67f428cd0e16a605dbdc2b1e28a1628c0add9886fc5e577e5b730417eff9d6606bee69743e665af6deb1ff7eaf5e916d9490849d5b3e561ef91
|
|
7
|
+
data.tar.gz: 72738a73a913e8c5b38e9778c534bf52b7f2295077d4e6fd3d65ff84d834665ee23e2feaea280bfe4a6604d21044a1667eb328ad276122be5c409d82f9af0532
|
data/Gemfile.lock
CHANGED
|
@@ -10,46 +10,44 @@ GIT
|
|
|
10
10
|
PATH
|
|
11
11
|
remote: .
|
|
12
12
|
specs:
|
|
13
|
-
catarse_moip (
|
|
13
|
+
catarse_moip (2.0.0)
|
|
14
14
|
libxml-ruby (~> 2.6.0)
|
|
15
|
-
rails (~>
|
|
15
|
+
rails (~> 4.0)
|
|
16
16
|
|
|
17
17
|
GEM
|
|
18
18
|
remote: http://rubygems.org/
|
|
19
19
|
specs:
|
|
20
|
-
actionmailer (
|
|
21
|
-
actionpack (=
|
|
20
|
+
actionmailer (4.0.0)
|
|
21
|
+
actionpack (= 4.0.0)
|
|
22
22
|
mail (~> 2.5.3)
|
|
23
|
-
actionpack (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
builder (~> 3.0.0)
|
|
23
|
+
actionpack (4.0.0)
|
|
24
|
+
activesupport (= 4.0.0)
|
|
25
|
+
builder (~> 3.1.0)
|
|
27
26
|
erubis (~> 2.7.0)
|
|
28
|
-
|
|
29
|
-
rack (~>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
builder (3.0.4)
|
|
27
|
+
rack (~> 1.5.2)
|
|
28
|
+
rack-test (~> 0.6.2)
|
|
29
|
+
activemodel (4.0.0)
|
|
30
|
+
activesupport (= 4.0.0)
|
|
31
|
+
builder (~> 3.1.0)
|
|
32
|
+
activerecord (4.0.0)
|
|
33
|
+
activemodel (= 4.0.0)
|
|
34
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
|
35
|
+
activesupport (= 4.0.0)
|
|
36
|
+
arel (~> 4.0.0)
|
|
37
|
+
activerecord-deprecated_finders (1.0.3)
|
|
38
|
+
activesupport (4.0.0)
|
|
39
|
+
i18n (~> 0.6, >= 0.6.4)
|
|
40
|
+
minitest (~> 4.2)
|
|
41
|
+
multi_json (~> 1.3)
|
|
42
|
+
thread_safe (~> 0.1)
|
|
43
|
+
tzinfo (~> 0.3.37)
|
|
44
|
+
arel (4.0.0)
|
|
45
|
+
atomic (1.1.13)
|
|
46
|
+
builder (3.1.4)
|
|
49
47
|
crack (0.1.8)
|
|
50
|
-
database_cleaner (1.
|
|
48
|
+
database_cleaner (1.1.1)
|
|
51
49
|
diff-lcs (1.2.4)
|
|
52
|
-
enumerate_it (1.
|
|
50
|
+
enumerate_it (1.1.1)
|
|
53
51
|
activesupport (>= 3.0.0)
|
|
54
52
|
erubis (2.7.0)
|
|
55
53
|
factory_girl (4.2.0)
|
|
@@ -60,62 +58,59 @@ GEM
|
|
|
60
58
|
hike (1.2.3)
|
|
61
59
|
httparty (0.6.1)
|
|
62
60
|
crack (= 0.1.8)
|
|
63
|
-
i18n (0.6.
|
|
64
|
-
journey (1.0.4)
|
|
65
|
-
json (1.8.0)
|
|
61
|
+
i18n (0.6.5)
|
|
66
62
|
libxml-ruby (2.6.0)
|
|
67
63
|
mail (2.5.4)
|
|
68
64
|
mime-types (~> 1.16)
|
|
69
65
|
treetop (~> 1.4.8)
|
|
70
|
-
mime-types (1.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
mime-types (1.24)
|
|
67
|
+
minitest (4.7.5)
|
|
68
|
+
multi_json (1.7.9)
|
|
69
|
+
nokogiri (1.5.10)
|
|
70
|
+
pg (0.16.0)
|
|
74
71
|
polyglot (0.3.3)
|
|
75
|
-
rack (1.
|
|
76
|
-
rack-cache (1.2)
|
|
77
|
-
rack (>= 0.4)
|
|
78
|
-
rack-ssl (1.3.3)
|
|
79
|
-
rack
|
|
72
|
+
rack (1.5.2)
|
|
80
73
|
rack-test (0.6.2)
|
|
81
74
|
rack (>= 1.0)
|
|
82
|
-
rails (
|
|
83
|
-
actionmailer (=
|
|
84
|
-
actionpack (=
|
|
85
|
-
activerecord (=
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
railties (
|
|
91
|
-
actionpack (=
|
|
92
|
-
activesupport (=
|
|
93
|
-
rack-ssl (~> 1.3.2)
|
|
75
|
+
rails (4.0.0)
|
|
76
|
+
actionmailer (= 4.0.0)
|
|
77
|
+
actionpack (= 4.0.0)
|
|
78
|
+
activerecord (= 4.0.0)
|
|
79
|
+
activesupport (= 4.0.0)
|
|
80
|
+
bundler (>= 1.3.0, < 2.0)
|
|
81
|
+
railties (= 4.0.0)
|
|
82
|
+
sprockets-rails (~> 2.0.0)
|
|
83
|
+
railties (4.0.0)
|
|
84
|
+
actionpack (= 4.0.0)
|
|
85
|
+
activesupport (= 4.0.0)
|
|
94
86
|
rake (>= 0.8.7)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
json (~> 1.4)
|
|
100
|
-
rspec-core (2.13.1)
|
|
101
|
-
rspec-expectations (2.13.0)
|
|
87
|
+
thor (>= 0.18.1, < 2.0)
|
|
88
|
+
rake (10.1.0)
|
|
89
|
+
rspec-core (2.14.5)
|
|
90
|
+
rspec-expectations (2.14.2)
|
|
102
91
|
diff-lcs (>= 1.1.3, < 2.0)
|
|
103
|
-
rspec-mocks (2.
|
|
104
|
-
rspec-rails (2.
|
|
92
|
+
rspec-mocks (2.14.3)
|
|
93
|
+
rspec-rails (2.14.0)
|
|
105
94
|
actionpack (>= 3.0)
|
|
106
95
|
activesupport (>= 3.0)
|
|
107
96
|
railties (>= 3.0)
|
|
108
|
-
rspec-core (~> 2.
|
|
109
|
-
rspec-expectations (~> 2.
|
|
110
|
-
rspec-mocks (~> 2.
|
|
111
|
-
sprockets (2.
|
|
97
|
+
rspec-core (~> 2.14.0)
|
|
98
|
+
rspec-expectations (~> 2.14.0)
|
|
99
|
+
rspec-mocks (~> 2.14.0)
|
|
100
|
+
sprockets (2.10.0)
|
|
112
101
|
hike (~> 1.2)
|
|
113
102
|
multi_json (~> 1.0)
|
|
114
103
|
rack (~> 1.0)
|
|
115
104
|
tilt (~> 1.1, != 1.3.0)
|
|
105
|
+
sprockets-rails (2.0.0)
|
|
106
|
+
actionpack (>= 3.0)
|
|
107
|
+
activesupport (>= 3.0)
|
|
108
|
+
sprockets (~> 2.8)
|
|
116
109
|
thor (0.18.1)
|
|
110
|
+
thread_safe (0.1.2)
|
|
111
|
+
atomic
|
|
117
112
|
tilt (1.4.1)
|
|
118
|
-
treetop (1.4.
|
|
113
|
+
treetop (1.4.14)
|
|
119
114
|
polyglot
|
|
120
115
|
polyglot (>= 0.3.1)
|
|
121
116
|
tzinfo (0.3.37)
|
|
@@ -130,4 +125,4 @@ DEPENDENCIES
|
|
|
130
125
|
factory_girl_rails
|
|
131
126
|
moip!
|
|
132
127
|
pg
|
|
133
|
-
rspec-rails
|
|
128
|
+
rspec-rails (~> 2.14.0)
|
data/README.md
CHANGED
|
@@ -18,6 +18,12 @@ Configure the routes for your Catarse application. Add the following lines in th
|
|
|
18
18
|
|
|
19
19
|
mount CatarseMoip::Engine => "/", :as => "catarse_moip"
|
|
20
20
|
|
|
21
|
+
## Rails 3.2.x and Rails 4 support
|
|
22
|
+
|
|
23
|
+
If you are using the Rails 3.2.x on Catarse's code, you can use the version `1.0.0`.
|
|
24
|
+
|
|
25
|
+
For Rails 4 support use the `2.0.0` version.
|
|
26
|
+
|
|
21
27
|
### Configurations
|
|
22
28
|
|
|
23
29
|
Create this configurations into Catarse database:
|
|
@@ -14,7 +14,7 @@ App.addChild('MoipForm', {
|
|
|
14
14
|
that.checkoutFailure({Code: 0, Mensagem: response.get_token_response.message});
|
|
15
15
|
}
|
|
16
16
|
else{
|
|
17
|
-
|
|
17
|
+
that.createMoipWidget(response);
|
|
18
18
|
if(_.isFunction(onSuccess)){
|
|
19
19
|
onSuccess(response);
|
|
20
20
|
}
|
|
@@ -23,6 +23,17 @@ App.addChild('MoipForm', {
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
|
|
26
|
+
createMoipWidget: function(data) {
|
|
27
|
+
widget_tag = $("<div/>").attr({
|
|
28
|
+
id: data.widget_tag.tag_id,
|
|
29
|
+
'data-token': data.widget_tag.token,
|
|
30
|
+
'callback-method-success': data.widget_tag.callback_success,
|
|
31
|
+
'callback-method-error': data.widget_tag.callback_error,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
$("#catarse_moip_form").prepend(widget_tag);
|
|
35
|
+
},
|
|
36
|
+
|
|
26
37
|
checkoutFailure: function(data) {
|
|
27
38
|
this.loader.hide();
|
|
28
39
|
var response_data = (data.length > 0 ? data[0] : data);
|
|
@@ -69,6 +80,10 @@ App.addChild('MoipForm', {
|
|
|
69
80
|
|
|
70
81
|
this.loader = this.$('.loader');
|
|
71
82
|
|
|
83
|
+
//this.paymentChoice = new CATARSE.PaymentChoice();
|
|
84
|
+
//this.paymentCard = new CATARSE.PaymentCard({moipForm: this});
|
|
85
|
+
//this.paymentSlip = new CATARSE.PaymentSlip({moipForm: this});
|
|
86
|
+
//this.paymentAccount = new CATARSE.PaymentAccount({moipForm: this});
|
|
72
87
|
window.checkoutSuccessful = _.bind(this.checkoutSuccessful, this);
|
|
73
88
|
window.checkoutFailure = _.bind(this.checkoutFailure, this);
|
|
74
89
|
}
|
|
@@ -22,7 +22,7 @@ module CatarseMoip
|
|
|
22
22
|
|
|
23
23
|
def create_notification
|
|
24
24
|
@backer = PaymentEngines.find_payment key: params[:id_transacao]
|
|
25
|
-
process_moip_message
|
|
25
|
+
process_moip_message(params)
|
|
26
26
|
return render :nothing => true, :status => 200
|
|
27
27
|
rescue Exception => e
|
|
28
28
|
return render :text => "#{e.inspect}: #{e.message} recebemos: #{params}", :status => 422
|
|
@@ -46,7 +46,7 @@ module CatarseMoip
|
|
|
46
46
|
|
|
47
47
|
def moip_response
|
|
48
48
|
@backer = PaymentEngines.find_payment id: params[:id], user_id: current_user.id
|
|
49
|
-
|
|
49
|
+
process_moip_message params[:response] unless params[:response]['StatusPagamento'] == 'Falha'
|
|
50
50
|
render nothing: true, status: 200
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -85,49 +85,49 @@ module CatarseMoip
|
|
|
85
85
|
|
|
86
86
|
backer.update_column :payment_token, response[:token] if response and response[:token]
|
|
87
87
|
|
|
88
|
-
render json: {
|
|
88
|
+
render json: {
|
|
89
|
+
get_token_response: response,
|
|
90
|
+
moip: @moip,
|
|
91
|
+
widget_tag: {
|
|
92
|
+
tag_id: 'MoipWidget',
|
|
93
|
+
token: response[:token],
|
|
94
|
+
callback_success: 'checkoutSuccessful',
|
|
95
|
+
callback_error: 'checkoutFailure'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
89
98
|
end
|
|
90
99
|
|
|
91
|
-
def
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
backer.with_lock do
|
|
98
|
-
if params["Status"] == "Autorizado"
|
|
99
|
-
backer.confirm!
|
|
100
|
-
elsif backer.pending?
|
|
101
|
-
backer.waiting!
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
backer.update_attributes({
|
|
105
|
-
:payment_id => params["CodigoMoIP"],
|
|
106
|
-
:payment_choice => params["FormaPagamento"],
|
|
107
|
-
:payment_service_fee => params["TaxaMoIP"]
|
|
108
|
-
}) if params
|
|
100
|
+
def update_backer params = nil
|
|
101
|
+
unless params && params["CodigoMoIP"] && params["TaxaMoIP"]
|
|
102
|
+
response = ::MoIP.query(backer.payment_token)
|
|
103
|
+
if response && response["Autorizacao"]
|
|
104
|
+
params = response["Autorizacao"]["Pagamento"]
|
|
105
|
+
params = params.first unless params.respond_to?(:key)
|
|
109
106
|
end
|
|
110
107
|
end
|
|
108
|
+
|
|
109
|
+
if params
|
|
110
|
+
backer.update_attributes({
|
|
111
|
+
:payment_id => params["CodigoMoIP"],
|
|
112
|
+
:payment_choice => params["FormaPagamento"],
|
|
113
|
+
:payment_service_fee => params["TaxaMoIP"]
|
|
114
|
+
})
|
|
115
|
+
end
|
|
111
116
|
end
|
|
112
117
|
|
|
113
|
-
def process_moip_message
|
|
118
|
+
def process_moip_message params
|
|
119
|
+
PaymentEngines.create_payment_notification backer_id: backer.id, extra_data: JSON.parse(params.to_json.force_encoding('iso-8859-1').encode('utf-8'))
|
|
114
120
|
backer.with_lock do
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
backer.refund! unless backer.refunded?
|
|
126
|
-
when TransactionStatus::CANCELED
|
|
127
|
-
backer.cancel! unless backer.canceled?
|
|
128
|
-
else
|
|
129
|
-
backer.waiting! if backer.pending?
|
|
130
|
-
end
|
|
121
|
+
update_backer if backer.payment_id.nil?
|
|
122
|
+
case params[:status_pagamento].to_i
|
|
123
|
+
when TransactionStatus::AUTHORIZED
|
|
124
|
+
backer.confirm! unless backer.confirmed?
|
|
125
|
+
when TransactionStatus::WRITTEN_BACK, TransactionStatus::REFUNDED
|
|
126
|
+
backer.refund! unless backer.refunded?
|
|
127
|
+
when TransactionStatus::CANCELED
|
|
128
|
+
backer.cancel! unless backer.canceled?
|
|
129
|
+
else
|
|
130
|
+
backer.waiting! if backer.pending?
|
|
131
131
|
end
|
|
132
132
|
end
|
|
133
133
|
end
|
data/catarse_moip.gemspec
CHANGED
|
@@ -17,10 +17,10 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
s.files = `git ls-files`.split($\)
|
|
18
18
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
|
19
19
|
|
|
20
|
-
s.add_dependency "rails", "~>
|
|
20
|
+
s.add_dependency "rails", "~> 4.0"
|
|
21
21
|
s.add_dependency('libxml-ruby', '~> 2.6.0')
|
|
22
22
|
|
|
23
|
-
s.add_development_dependency "rspec-rails"
|
|
23
|
+
s.add_development_dependency "rspec-rails", "~> 2.14.0"
|
|
24
24
|
s.add_development_dependency "factory_girl_rails"
|
|
25
25
|
s.add_development_dependency "database_cleaner"
|
|
26
26
|
end
|
data/config/routes.rb
CHANGED
data/lib/catarse_moip/version.rb
CHANGED
|
@@ -6,13 +6,13 @@ describe CatarseMoip::MoipController do
|
|
|
6
6
|
|
|
7
7
|
let(:get_token_response){{:status=>:fail, :code=>"171", :message=>"TelefoneFixo do endereço deverá ser enviado obrigatorio", :id=>"201210192052439150000024698931"}}
|
|
8
8
|
let(:backer){ double('backer', {
|
|
9
|
-
id: 1,
|
|
10
|
-
key: 'backer key',
|
|
11
|
-
payment_id: 'payment id',
|
|
12
|
-
project: project,
|
|
13
|
-
pending?: false,
|
|
14
|
-
value: 10,
|
|
15
|
-
user: user,
|
|
9
|
+
id: 1,
|
|
10
|
+
key: 'backer key',
|
|
11
|
+
payment_id: 'payment id',
|
|
12
|
+
project: project,
|
|
13
|
+
pending?: false,
|
|
14
|
+
value: 10,
|
|
15
|
+
user: user,
|
|
16
16
|
payer_name: 'foo',
|
|
17
17
|
payer_email: 'foo@bar.com',
|
|
18
18
|
address_street: 'test',
|
|
@@ -22,13 +22,7 @@ describe CatarseMoip::MoipController do
|
|
|
22
22
|
address_city: '123',
|
|
23
23
|
address_state: '123',
|
|
24
24
|
address_zip_code: '123',
|
|
25
|
-
address_phone_number: '123'
|
|
26
|
-
confirmed?: true,
|
|
27
|
-
confirm!: true,
|
|
28
|
-
canceled?: true,
|
|
29
|
-
cancel!: true,
|
|
30
|
-
refunded?: true,
|
|
31
|
-
refund!: true
|
|
25
|
+
address_phone_number: '123'
|
|
32
26
|
}) }
|
|
33
27
|
|
|
34
28
|
let(:user){ double('user', id: 1) }
|
|
@@ -59,69 +53,8 @@ describe CatarseMoip::MoipController do
|
|
|
59
53
|
|
|
60
54
|
context "when we seach for an existing backer" do
|
|
61
55
|
before do
|
|
62
|
-
controller.stub(:params).and_return({:id_transacao =>backer.key, :controller => "catarse_moip/moip", :action => "create_notification"})
|
|
63
56
|
PaymentEngines.should_receive(:find_payment).with(key: backer.key).and_return(backer)
|
|
64
|
-
controller.should_receive(:process_moip_message)
|
|
65
|
-
post :create_notification, {:id_transacao => backer.key, :use_route => 'catarse_moip'}
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
its(:body){ should == ' ' }
|
|
69
|
-
its(:status){ should == 200 }
|
|
70
|
-
it("should assign backer"){ assigns(:backer).should == backer }
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
context "when receive ordered notification for backer" do
|
|
74
|
-
before do
|
|
75
|
-
controller.stub(:params).and_return({:cod_moip => 125, :id_transacao =>backer.key, :controller => "catarse_moip/moip", :action => "create_notification", :status_pagamento => 5})
|
|
76
|
-
backer.stub(:payment_id).and_return('123')
|
|
77
|
-
|
|
78
|
-
controller.should_receive(:process_moip_message).and_call_original
|
|
79
|
-
backer.should_receive(:update_attributes).with(payment_id: 125)
|
|
80
|
-
post :create_notification, {:id_transacao => backer.key, :use_route => 'catarse_moip'}
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
its(:body){ should == ' ' }
|
|
84
|
-
its(:status){ should == 200 }
|
|
85
|
-
it("should assign backer"){ assigns(:backer).should == backer }
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
context "when we receive a notification with the same payment id but with another status" do
|
|
89
|
-
before do
|
|
90
|
-
controller.stub(:params).and_return({:cod_moip => 123, :id_transacao =>backer.key, :controller => "catarse_moip/moip", :action => "create_notification", :status_pagamento => 1})
|
|
91
|
-
backer.stub(:payment_id).and_return('123')
|
|
92
|
-
|
|
93
|
-
controller.should_receive(:process_moip_message).and_call_original
|
|
94
|
-
backer.should_receive(:update_attributes).with(payment_id: 123)
|
|
95
|
-
post :create_notification, {:id_transacao => backer.key, :use_route => 'catarse_moip'}
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
its(:body){ should == ' ' }
|
|
99
|
-
its(:status){ should == 200 }
|
|
100
|
-
it("should assign backer"){ assigns(:backer).should == backer }
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
context "when receive a unordered notification for backer" do
|
|
104
|
-
before do
|
|
105
|
-
controller.stub(:params).and_return({:cod_moip => 122, :id_transacao =>backer.key, :controller => "catarse_moip/moip", :action => "create_notification", :status_pagamento => 5})
|
|
106
|
-
backer.stub(:payment_id).and_return('123')
|
|
107
|
-
|
|
108
|
-
controller.should_receive(:process_moip_message).and_call_original
|
|
109
|
-
backer.should_not_receive(:update_attributes).with(payment_id: 122)
|
|
110
|
-
post :create_notification, {:id_transacao => backer.key, :use_route => 'catarse_moip'}
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
its(:body){ should == ' ' }
|
|
114
|
-
its(:status){ should == 200 }
|
|
115
|
-
it("should assign backer"){ assigns(:backer).should == backer }
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
context "when backer payment_id is null" do
|
|
119
|
-
before do
|
|
120
|
-
controller.stub(:params).and_return({:cod_moip => 122, :id_transacao =>backer.key, :controller => "catarse_moip/moip", :action => "create_notification", :status_pagamento => 5})
|
|
121
|
-
backer.stub(:payment_id).and_return(nil)
|
|
122
|
-
|
|
123
|
-
controller.should_receive(:process_moip_message).and_call_original
|
|
124
|
-
backer.should_receive(:update_attributes).with(payment_id: 122)
|
|
57
|
+
controller.should_receive(:process_moip_message).with({"id_transacao"=>backer.key, "controller"=>"catarse_moip/moip", "action"=>"create_notification"})
|
|
125
58
|
post :create_notification, {:id_transacao => backer.key, :use_route => 'catarse_moip'}
|
|
126
59
|
end
|
|
127
60
|
|
|
@@ -136,7 +69,7 @@ describe CatarseMoip::MoipController do
|
|
|
136
69
|
|
|
137
70
|
context "when the content of get_javascript_url raises an error" do
|
|
138
71
|
before do
|
|
139
|
-
controller.should_receive(:open).at_least(3).times.and_raise('error')
|
|
72
|
+
controller.should_receive(:open).at_least(3).times.and_raise('error')
|
|
140
73
|
->{
|
|
141
74
|
get :js, locale: :pt, use_route: 'catarse_moip'
|
|
142
75
|
}.should raise_error('error')
|
|
@@ -146,7 +79,7 @@ describe CatarseMoip::MoipController do
|
|
|
146
79
|
|
|
147
80
|
context "when the content of get_javascript_url is read without errors" do
|
|
148
81
|
before do
|
|
149
|
-
controller.should_receive(:open).and_return(file)
|
|
82
|
+
controller.should_receive(:open).and_return(file)
|
|
150
83
|
file.should_receive(:set_encoding).and_return(file)
|
|
151
84
|
file.should_receive(:read).and_return(file)
|
|
152
85
|
file.should_receive(:encode).and_return('js content')
|
|
@@ -160,7 +93,7 @@ describe CatarseMoip::MoipController do
|
|
|
160
93
|
describe "POST moip_response" do
|
|
161
94
|
let(:processor){ double('moip processor') }
|
|
162
95
|
before do
|
|
163
|
-
controller.should_receive(:
|
|
96
|
+
controller.should_receive(:process_moip_message)
|
|
164
97
|
post :moip_response, id: backer.id, response: {StatusPagamento: 'Sucesso'}, use_route: 'catarse_moip'
|
|
165
98
|
end
|
|
166
99
|
|
|
@@ -173,22 +106,35 @@ describe CatarseMoip::MoipController do
|
|
|
173
106
|
end
|
|
174
107
|
|
|
175
108
|
its(:status){ should == 200 }
|
|
176
|
-
its(:body){ should == "{\"get_token_response\":{\"status\":\"fail\",\"code\":\"171\",\"message\":\"TelefoneFixo do endereço deverá ser enviado obrigatorio\",\"id\":\"201210192052439150000024698931\"},\"moip\":\"{}\",\"widget_tag\":\"
|
|
109
|
+
its(:body){ should == "{\"get_token_response\":{\"status\":\"fail\",\"code\":\"171\",\"message\":\"TelefoneFixo do endereço deverá ser enviado obrigatorio\",\"id\":\"201210192052439150000024698931\"},\"moip\":\"{}\",\"widget_tag\":{\"tag_id\":\"MoipWidget\",\"token\":null,\"callback_success\":\"checkoutSuccessful\",\"callback_error\":\"checkoutFailure\"}}" }
|
|
177
110
|
end
|
|
178
111
|
|
|
179
|
-
describe "#
|
|
112
|
+
describe "#update_backer" do
|
|
180
113
|
before do
|
|
181
114
|
controller.stub(:backer).and_return(backer)
|
|
182
115
|
backer.stub(:payment_token).and_return('token')
|
|
183
116
|
end
|
|
184
117
|
|
|
118
|
+
context "with parameters containing CodigoMoIP and TaxaMoIP" do
|
|
119
|
+
let(:payment){ {"Status" => "Autorizado","Codigo" => "0","CodigoRetorno" => "0","TaxaMoIP" => "1.54","StatusPagamento" => "Sucesso","CodigoMoIP" => "18093844","Mensagem" => "Requisição processada com sucesso","TotalPago" => "25.00","url" => "https => //www.moip.com.br/Instrucao.do?token=R2W0N123E005F2A911V6O2I0Y3S7M4J853H0S0F0T0D044T8F4H4E9G0I3W8"} }
|
|
120
|
+
before do
|
|
121
|
+
MoIP.should_not_receive(:query)
|
|
122
|
+
backer.should_receive(:update_attributes).with({
|
|
123
|
+
payment_id: payment["CodigoMoIP"],
|
|
124
|
+
payment_choice: payment["FormaPagamento"],
|
|
125
|
+
payment_service_fee: payment["TaxaMoIP"]
|
|
126
|
+
})
|
|
127
|
+
end
|
|
128
|
+
it("should call update attributes but not call MoIP.query"){ controller.update_backer payment }
|
|
129
|
+
end
|
|
130
|
+
|
|
185
131
|
context "with no response from moip" do
|
|
186
132
|
let(:moip_query_response) { nil }
|
|
187
133
|
before do
|
|
188
134
|
MoIP.should_receive(:query).with(backer.payment_token).and_return(moip_query_response)
|
|
189
135
|
backer.should_not_receive(:update_attributes)
|
|
190
136
|
end
|
|
191
|
-
it("should never call update attributes"){ controller.
|
|
137
|
+
it("should never call update attributes"){ controller.update_backer }
|
|
192
138
|
end
|
|
193
139
|
|
|
194
140
|
context "with an incomplete transaction" do
|
|
@@ -199,7 +145,7 @@ describe CatarseMoip::MoipController do
|
|
|
199
145
|
MoIP.should_receive(:query).with(backer.payment_token).and_return(moip_query_response)
|
|
200
146
|
backer.should_not_receive(:update_attributes)
|
|
201
147
|
end
|
|
202
|
-
it("should never call update attributes"){ controller.
|
|
148
|
+
it("should never call update attributes"){ controller.update_backer }
|
|
203
149
|
end
|
|
204
150
|
|
|
205
151
|
context "with a real data set that works for some cases" do
|
|
@@ -209,14 +155,13 @@ describe CatarseMoip::MoipController do
|
|
|
209
155
|
before do
|
|
210
156
|
MoIP.should_receive(:query).with(backer.payment_token).and_return(moip_query_response)
|
|
211
157
|
payment = moip_query_response["Autorizacao"]["Pagamento"].first
|
|
212
|
-
backer.should_receive(:confirm!)
|
|
213
158
|
backer.should_receive(:update_attributes).with({
|
|
214
159
|
payment_id: payment["CodigoMoIP"],
|
|
215
160
|
payment_choice: payment["FormaPagamento"],
|
|
216
161
|
payment_service_fee: payment["TaxaMoIP"]
|
|
217
162
|
})
|
|
218
163
|
end
|
|
219
|
-
it("should call update attributes"){ controller.
|
|
164
|
+
it("should call update attributes"){ controller.update_backer }
|
|
220
165
|
end
|
|
221
166
|
end
|
|
222
167
|
|
|
@@ -228,41 +173,57 @@ describe CatarseMoip::MoipController do
|
|
|
228
173
|
controller.stub(:update_backer)
|
|
229
174
|
end
|
|
230
175
|
|
|
176
|
+
context "when we already have the payment_id in backers table" do
|
|
177
|
+
before do
|
|
178
|
+
backer.stub(:payment_id).and_return('test')
|
|
179
|
+
controller.should_not_receive(:update_backer)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
it 'should never call update_backer' do
|
|
183
|
+
controller.process_moip_message post_moip_params.merge!({:id_transacao => backer.key, :status_pagamento => CatarseMoip::MoipController::TransactionStatus::AUTHORIZED})
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
context "when we still do not have the payment_id in backers table" do
|
|
188
|
+
before do
|
|
189
|
+
backer.stub(:payment_id).and_return(nil)
|
|
190
|
+
controller.should_receive(:update_backer)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
it 'should call update_backer on the processor' do
|
|
194
|
+
controller.process_moip_message post_moip_params.merge!({:id_transacao => backer.key, :status_pagamento => CatarseMoip::MoipController::TransactionStatus::AUTHORIZED})
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
231
198
|
context "when there is a written back request and backer is not refunded" do
|
|
232
199
|
before do
|
|
233
|
-
controller.stub(:params).and_return(post_moip_params.merge!({:id_transacao => backer.key, :status_pagamento => CatarseMoip::MoipController::TransactionStatus::WRITTEN_BACK}))
|
|
234
200
|
backer.stub(:refunded?).and_return(false)
|
|
235
201
|
backer.should_receive(:refund!)
|
|
236
|
-
backer.should_receive(:update_attributes)
|
|
237
202
|
end
|
|
238
203
|
|
|
239
204
|
it 'should call refund!' do
|
|
240
|
-
controller.process_moip_message
|
|
205
|
+
controller.process_moip_message post_moip_params.merge!({:id_transacao => backer.key, :status_pagamento => CatarseMoip::MoipController::TransactionStatus::WRITTEN_BACK})
|
|
241
206
|
end
|
|
242
207
|
end
|
|
243
208
|
|
|
244
209
|
context "when there is an authorized request" do
|
|
245
210
|
before do
|
|
246
|
-
controller.stub(:params).and_return(post_moip_params.merge!({:id_transacao => backer.key, :status_pagamento => CatarseMoip::MoipController::TransactionStatus::AUTHORIZED}))
|
|
247
211
|
backer.should_receive(:confirm!)
|
|
248
|
-
backer.should_receive(:update_attributes)
|
|
249
212
|
end
|
|
250
213
|
|
|
251
214
|
it 'should call confirm!' do
|
|
252
|
-
controller.process_moip_message
|
|
215
|
+
controller.process_moip_message post_moip_params.merge!({:id_transacao => backer.key, :status_pagamento => CatarseMoip::MoipController::TransactionStatus::AUTHORIZED})
|
|
253
216
|
end
|
|
254
217
|
end
|
|
255
218
|
|
|
256
219
|
context "when there is a refund request" do
|
|
257
220
|
before do
|
|
258
|
-
controller.stub(:params).and_return(post_moip_params.merge!({:id_transacao => backer.key, :status_pagamento => CatarseMoip::MoipController::TransactionStatus::REFUNDED}))
|
|
259
221
|
backer.stub(:refunded?).and_return(false)
|
|
260
222
|
backer.should_receive(:refund!)
|
|
261
|
-
backer.should_receive(:update_attributes)
|
|
262
223
|
end
|
|
263
224
|
|
|
264
225
|
it 'should mark refunded to true' do
|
|
265
|
-
controller.process_moip_message
|
|
226
|
+
controller.process_moip_message post_moip_params.merge!({:id_transacao => backer.key, :status_pagamento => CatarseMoip::MoipController::TransactionStatus::REFUNDED})
|
|
266
227
|
end
|
|
267
228
|
end
|
|
268
229
|
end
|
|
@@ -2,8 +2,9 @@ require File.expand_path('../boot', __FILE__)
|
|
|
2
2
|
|
|
3
3
|
require 'rails/all'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
# Require the gems listed in Gemfile, including any gems
|
|
6
|
+
# you've limited to :test, :development, or :production.
|
|
7
|
+
Bundler.require(:default, Rails.env)
|
|
7
8
|
|
|
8
9
|
module Dummy
|
|
9
10
|
class Application < Rails::Application
|
|
@@ -11,16 +12,6 @@ module Dummy
|
|
|
11
12
|
# Application configuration should go into files in config/initializers
|
|
12
13
|
# -- all .rb files in that directory are automatically loaded.
|
|
13
14
|
|
|
14
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
|
15
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
|
16
|
-
|
|
17
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
18
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
19
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
20
|
-
|
|
21
|
-
# Activate observers that should always be running.
|
|
22
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
23
|
-
|
|
24
15
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
25
16
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
26
17
|
# config.time_zone = 'Central Time (US & Canada)'
|
|
@@ -28,32 +19,5 @@ module Dummy
|
|
|
28
19
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
29
20
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
30
21
|
# config.i18n.default_locale = :de
|
|
31
|
-
|
|
32
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
|
33
|
-
config.encoding = "utf-8"
|
|
34
|
-
|
|
35
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
|
36
|
-
config.filter_parameters += [:password]
|
|
37
|
-
|
|
38
|
-
# Enable escaping HTML in JSON.
|
|
39
|
-
config.active_support.escape_html_entities_in_json = true
|
|
40
|
-
|
|
41
|
-
# Use SQL instead of Active Record's schema dumper when creating the database.
|
|
42
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
43
|
-
# like if you have constraints or database-specific column types
|
|
44
|
-
# config.active_record.schema_format = :sql
|
|
45
|
-
|
|
46
|
-
# Enforce whitelist mode for mass assignment.
|
|
47
|
-
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
|
48
|
-
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
|
49
|
-
# parameters by using an attr_accessible or attr_protected declaration.
|
|
50
|
-
config.active_record.whitelist_attributes = true
|
|
51
|
-
|
|
52
|
-
# Enable the asset pipeline
|
|
53
|
-
config.assets.enabled = true
|
|
54
|
-
|
|
55
|
-
# Version of your assets, change this if you want to expire all your assets
|
|
56
|
-
config.assets.version = '1.0'
|
|
57
22
|
end
|
|
58
23
|
end
|
|
59
|
-
|
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
Dummy::Application.configure do
|
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
3
|
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
|
5
5
|
# every request. This slows down response time but is perfect for development
|
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
|
7
7
|
config.cache_classes = false
|
|
8
8
|
|
|
9
|
-
#
|
|
10
|
-
config.
|
|
9
|
+
# Do not eager load code on boot.
|
|
10
|
+
config.eager_load = false
|
|
11
11
|
|
|
12
|
-
# Show full error reports and disable caching
|
|
12
|
+
# Show full error reports and disable caching.
|
|
13
13
|
config.consider_all_requests_local = true
|
|
14
14
|
config.action_controller.perform_caching = false
|
|
15
15
|
|
|
16
|
-
# Don't care if the mailer can't send
|
|
16
|
+
# Don't care if the mailer can't send.
|
|
17
17
|
config.action_mailer.raise_delivery_errors = false
|
|
18
18
|
|
|
19
|
-
# Print deprecation notices to the Rails logger
|
|
19
|
+
# Print deprecation notices to the Rails logger.
|
|
20
20
|
config.active_support.deprecation = :log
|
|
21
21
|
|
|
22
|
-
#
|
|
23
|
-
config.
|
|
22
|
+
# Raise an error on page load if there are pending migrations
|
|
23
|
+
config.active_record.migration_error = :page_load
|
|
24
24
|
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# Log the query plan for queries taking more than this (works
|
|
29
|
-
# with SQLite, MySQL, and PostgreSQL)
|
|
30
|
-
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
|
31
|
-
|
|
32
|
-
# Do not compress assets
|
|
33
|
-
config.assets.compress = false
|
|
34
|
-
|
|
35
|
-
# Expands the lines which load the assets
|
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
|
27
|
+
# number of complex assets.
|
|
36
28
|
config.assets.debug = true
|
|
37
29
|
end
|
|
@@ -1,67 +1,80 @@
|
|
|
1
1
|
Dummy::Application.configure do
|
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
3
|
|
|
4
|
-
# Code is not reloaded between requests
|
|
4
|
+
# Code is not reloaded between requests.
|
|
5
5
|
config.cache_classes = true
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
|
8
|
+
# your application in memory, allowing both thread web servers
|
|
9
|
+
# and those relying on copy on write to perform better.
|
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
|
11
|
+
config.eager_load = true
|
|
12
|
+
|
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
|
8
14
|
config.consider_all_requests_local = false
|
|
9
15
|
config.action_controller.perform_caching = true
|
|
10
16
|
|
|
11
|
-
#
|
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
|
20
|
+
# config.action_dispatch.rack_cache = true
|
|
21
|
+
|
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
|
12
23
|
config.serve_static_assets = false
|
|
13
24
|
|
|
14
|
-
# Compress JavaScripts and CSS
|
|
15
|
-
config.assets.
|
|
25
|
+
# Compress JavaScripts and CSS.
|
|
26
|
+
config.assets.js_compressor = :uglifier
|
|
27
|
+
# config.assets.css_compressor = :sass
|
|
16
28
|
|
|
17
|
-
#
|
|
29
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
|
18
30
|
config.assets.compile = false
|
|
19
31
|
|
|
20
|
-
# Generate digests for assets URLs
|
|
32
|
+
# Generate digests for assets URLs.
|
|
21
33
|
config.assets.digest = true
|
|
22
34
|
|
|
23
|
-
#
|
|
24
|
-
|
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
|
36
|
+
config.assets.version = '1.0'
|
|
25
37
|
|
|
26
|
-
# Specifies the header that your server uses for sending files
|
|
38
|
+
# Specifies the header that your server uses for sending files.
|
|
27
39
|
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
|
28
40
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
|
29
41
|
|
|
30
42
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
31
43
|
# config.force_ssl = true
|
|
32
44
|
|
|
33
|
-
#
|
|
34
|
-
|
|
45
|
+
# Set to :debug to see everything in the log.
|
|
46
|
+
config.log_level = :info
|
|
35
47
|
|
|
36
|
-
# Prepend all log lines with the following tags
|
|
48
|
+
# Prepend all log lines with the following tags.
|
|
37
49
|
# config.log_tags = [ :subdomain, :uuid ]
|
|
38
50
|
|
|
39
|
-
# Use a different logger for distributed setups
|
|
51
|
+
# Use a different logger for distributed setups.
|
|
40
52
|
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
|
41
53
|
|
|
42
|
-
# Use a different cache store in production
|
|
54
|
+
# Use a different cache store in production.
|
|
43
55
|
# config.cache_store = :mem_cache_store
|
|
44
56
|
|
|
45
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
|
57
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
46
58
|
# config.action_controller.asset_host = "http://assets.example.com"
|
|
47
59
|
|
|
48
|
-
# Precompile additional assets
|
|
60
|
+
# Precompile additional assets.
|
|
61
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
|
49
62
|
# config.assets.precompile += %w( search.js )
|
|
50
63
|
|
|
51
|
-
#
|
|
64
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
|
65
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
52
66
|
# config.action_mailer.raise_delivery_errors = false
|
|
53
67
|
|
|
54
|
-
# Enable threaded mode
|
|
55
|
-
# config.threadsafe!
|
|
56
|
-
|
|
57
68
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
58
|
-
# the I18n.default_locale when a translation can not be found)
|
|
69
|
+
# the I18n.default_locale when a translation can not be found).
|
|
59
70
|
config.i18n.fallbacks = true
|
|
60
71
|
|
|
61
|
-
# Send deprecation notices to registered listeners
|
|
72
|
+
# Send deprecation notices to registered listeners.
|
|
62
73
|
config.active_support.deprecation = :notify
|
|
63
74
|
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
|
|
75
|
+
# Disable automatic flushing of the log to improve performance.
|
|
76
|
+
# config.autoflush_log = false
|
|
77
|
+
|
|
78
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
79
|
+
config.log_formatter = ::Logger::Formatter.new
|
|
67
80
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Dummy::Application.configure do
|
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
3
|
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
|
5
5
|
# test suite. You never need to work with it otherwise. Remember that
|
|
@@ -7,31 +7,30 @@ Dummy::Application.configure do
|
|
|
7
7
|
# and recreated between test runs. Don't rely on the data there!
|
|
8
8
|
config.cache_classes = true
|
|
9
9
|
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
|
13
|
+
config.eager_load = false
|
|
13
14
|
|
|
14
|
-
#
|
|
15
|
-
config.
|
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
|
16
|
+
config.serve_static_assets = true
|
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
|
16
18
|
|
|
17
|
-
# Show full error reports and disable caching
|
|
19
|
+
# Show full error reports and disable caching.
|
|
18
20
|
config.consider_all_requests_local = true
|
|
19
21
|
config.action_controller.perform_caching = false
|
|
20
22
|
|
|
21
|
-
# Raise exceptions instead of rendering exception templates
|
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
|
22
24
|
config.action_dispatch.show_exceptions = false
|
|
23
25
|
|
|
24
|
-
# Disable request forgery protection in test environment
|
|
25
|
-
config.action_controller.allow_forgery_protection
|
|
26
|
+
# Disable request forgery protection in test environment.
|
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
|
26
28
|
|
|
27
29
|
# Tell Action Mailer not to deliver emails to the real world.
|
|
28
30
|
# The :test delivery method accumulates sent emails in the
|
|
29
31
|
# ActionMailer::Base.deliveries array.
|
|
30
32
|
config.action_mailer.delivery_method = :test
|
|
31
33
|
|
|
32
|
-
#
|
|
33
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
|
34
|
-
|
|
35
|
-
# Print deprecation notices to the stderr
|
|
34
|
+
# Print deprecation notices to the stderr.
|
|
36
35
|
config.active_support.deprecation = :stderr
|
|
37
36
|
end
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
|
2
2
|
|
|
3
|
-
# Add new inflection rules using the following format
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
|
4
|
+
# are locale specific, and you may define rules for as many different
|
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
6
7
|
# inflect.plural /^(ox)$/i, '\1en'
|
|
7
8
|
# inflect.singular /^(ox)en/i, '\1'
|
|
8
9
|
# inflect.irregular 'person', 'people'
|
|
9
10
|
# inflect.uncountable %w( fish sheep )
|
|
10
11
|
# end
|
|
11
|
-
|
|
12
|
+
|
|
12
13
|
# These inflection rules are supported but not enabled by default:
|
|
13
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
14
15
|
# inflect.acronym 'RESTful'
|
|
15
16
|
# end
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
|
2
2
|
|
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
|
4
4
|
# If you change this key, all old signed cookies will become invalid!
|
|
5
|
+
|
|
5
6
|
# Make sure the secret is at least 30 characters and all random,
|
|
6
7
|
# no regular words or you'll be exposed to dictionary attacks.
|
|
7
|
-
|
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
|
9
|
+
|
|
10
|
+
# Make sure your secret_key_base is kept private
|
|
11
|
+
# if you're sharing your code publicly.
|
|
12
|
+
Dummy::Application.config.secret_key_base = '56b32f3c2786d84f9dc2a481c726e5a6675e0466e0bd7031322d20df94ec5010c8a488a29f4f0856a10bb02b4117f80ac70429f9926efe0583a1472857bb6421'
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
|
2
2
|
|
|
3
3
|
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
|
4
|
-
|
|
5
|
-
# Use the database for sessions instead of the cookie-based default,
|
|
6
|
-
# which shouldn't be used to store highly confidential information
|
|
7
|
-
# (create the session table with "rails generate session_migration")
|
|
8
|
-
# Dummy::Application.config.session_store :active_record_store
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
# This file contains settings for ActionController::ParamsWrapper which
|
|
4
4
|
# is enabled by default.
|
|
5
5
|
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
|
8
|
-
wrap_parameters format: [:json]
|
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
#
|
|
12
|
-
ActiveSupport.on_load(:active_record) do
|
|
13
|
-
self.include_root_in_json =
|
|
14
|
-
end
|
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
|
13
|
+
# self.include_root_in_json = true
|
|
14
|
+
# end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: catarse_moip
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Antônio Roberto Silva
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2013-
|
|
13
|
+
date: 2013-08-15 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rails
|
|
@@ -18,14 +18,14 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version:
|
|
21
|
+
version: '4.0'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
25
|
requirements:
|
|
26
26
|
- - ~>
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
|
-
version:
|
|
28
|
+
version: '4.0'
|
|
29
29
|
- !ruby/object:Gem::Dependency
|
|
30
30
|
name: libxml-ruby
|
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -44,16 +44,16 @@ dependencies:
|
|
|
44
44
|
name: rspec-rails
|
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
|
47
|
-
- -
|
|
47
|
+
- - ~>
|
|
48
48
|
- !ruby/object:Gem::Version
|
|
49
|
-
version:
|
|
49
|
+
version: 2.14.0
|
|
50
50
|
type: :development
|
|
51
51
|
prerelease: false
|
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
53
53
|
requirements:
|
|
54
|
-
- -
|
|
54
|
+
- - ~>
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
|
-
version:
|
|
56
|
+
version: 2.14.0
|
|
57
57
|
- !ruby/object:Gem::Dependency
|
|
58
58
|
name: factory_girl_rails
|
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -150,6 +150,7 @@ files:
|
|
|
150
150
|
- test/dummy/config/environments/production.rb
|
|
151
151
|
- test/dummy/config/environments/test.rb
|
|
152
152
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
|
153
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
|
153
154
|
- test/dummy/config/initializers/inflections.rb
|
|
154
155
|
- test/dummy/config/initializers/mime_types.rb
|
|
155
156
|
- test/dummy/config/initializers/secret_token.rb
|
|
@@ -216,6 +217,7 @@ test_files:
|
|
|
216
217
|
- test/dummy/config/environments/production.rb
|
|
217
218
|
- test/dummy/config/environments/test.rb
|
|
218
219
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
|
220
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
|
219
221
|
- test/dummy/config/initializers/inflections.rb
|
|
220
222
|
- test/dummy/config/initializers/mime_types.rb
|
|
221
223
|
- test/dummy/config/initializers/secret_token.rb
|