catarse_moip 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -6
- data/.rspec +2 -0
- data/.travis.yml +17 -0
- data/Gemfile +2 -109
- data/Gemfile.lock +73 -476
- data/README.md +2 -26
- data/Rakefile +7 -2
- data/app/assets/javascripts/catarse_moip/moip_form.js +80 -0
- data/app/assets/javascripts/catarse_moip/payment_account.js +37 -0
- data/app/assets/javascripts/catarse_moip/payment_card.js +89 -0
- data/app/assets/javascripts/catarse_moip/payment_choice.js +19 -0
- data/app/assets/javascripts/catarse_moip/payment_slip.js +35 -0
- data/app/assets/javascripts/catarse_moip/user_document.js +111 -0
- data/app/assets/javascripts/catarse_moip.js +7 -0
- data/app/controllers/catarse_moip/moip_controller.rb +126 -0
- data/app/views/catarse_moip/moip/review.html.slim +105 -0
- data/catarse_moip.gemspec +5 -5
- data/config/initializers/moip.rb +4 -7
- data/config/initializers/register.rb +5 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/pt.yml +19 -0
- data/config/routes.rb +9 -5
- data/lib/catarse_moip/engine.rb +7 -0
- data/lib/catarse_moip/version.rb +1 -1
- data/lib/catarse_moip.rb +1 -1
- data/lib/moip_transparente/checkout.rb +218 -0
- data/lib/moip_transparente/version.rb +3 -0
- data/lib/moip_transparente.rb +32 -0
- data/spec/controllers/catarse_moip/moip_controller_spec.rb +230 -0
- data/spec/fixtures/ipn_data.txt +1 -0
- data/spec/javascripts/moip_form_spec.js +25 -0
- data/spec/javascripts/support/app.js +1 -0
- data/spec/javascripts/support/backbone.js +1571 -0
- data/spec/javascripts/support/jquery.js +8829 -0
- data/spec/javascripts/support/skull.js +64 -0
- data/spec/javascripts/support/underscore.js +1227 -0
- data/spec/spec_helper.rb +2 -23
- 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 +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +50 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -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 +120 -35
- data/.gitmodules +0 -3
- data/app/controllers/catarse_moip/payment/moip_controller.rb +0 -49
- data/spec/controllers/catarse_moip/payment/moip_controller_spec.rb +0 -81
@@ -0,0 +1,64 @@
|
|
1
|
+
var Skull = { View: undefined };
|
2
|
+
if (typeof exports !== 'undefined') {
|
3
|
+
Skull = exports;
|
4
|
+
}
|
5
|
+
|
6
|
+
Skull.View = Backbone.View.extend({
|
7
|
+
addView: function(name, view){
|
8
|
+
if(!this['_' + name]){
|
9
|
+
this['_' + name] = new view({name: name, parent: this});
|
10
|
+
}
|
11
|
+
return this['_' + name];
|
12
|
+
},
|
13
|
+
|
14
|
+
initialize: function(options){
|
15
|
+
_.bindAll(this);
|
16
|
+
if(options){
|
17
|
+
this.name = options.name;
|
18
|
+
this.parent = options.parent;
|
19
|
+
}
|
20
|
+
|
21
|
+
if(_.isFunction(this.beforeActivate)){
|
22
|
+
this.beforeActivate();
|
23
|
+
}
|
24
|
+
|
25
|
+
this.createViewGetters();
|
26
|
+
|
27
|
+
if(_.isFunction(this.activate)){
|
28
|
+
this.activate();
|
29
|
+
}
|
30
|
+
},
|
31
|
+
|
32
|
+
navigate: function(url){
|
33
|
+
window.location.href = url;
|
34
|
+
},
|
35
|
+
|
36
|
+
// Create a getter to initilize each view defined in the constructor when needed
|
37
|
+
createViewGetters: function(){
|
38
|
+
_.each(Object.getPrototypeOf(this).constructor.views, function(val, key){
|
39
|
+
var name = key[0].toLowerCase() + key.substring(1);
|
40
|
+
Object.defineProperty(this, name, {
|
41
|
+
configurable: true,
|
42
|
+
enumerable: true,
|
43
|
+
get: function(){
|
44
|
+
return this.addView(name, val);
|
45
|
+
}
|
46
|
+
});
|
47
|
+
// Initialize the view if the el is present in the parent's DOM subtree
|
48
|
+
if(this.$(val.el).length > 0) this[name];
|
49
|
+
}, this);
|
50
|
+
}
|
51
|
+
},
|
52
|
+
// Static methods
|
53
|
+
{
|
54
|
+
// We just overwrite the extend to extract the el property and store it in the constructor
|
55
|
+
// That's how we look for the view's el before initializing it
|
56
|
+
views: {},
|
57
|
+
addChild: function(name, protoProps, staticProps){
|
58
|
+
var child = Skull.View.extend(protoProps, _.extend({views: {}}, staticProps));
|
59
|
+
child.el = protoProps.el;
|
60
|
+
this.views[name] = child;
|
61
|
+
return this;
|
62
|
+
}
|
63
|
+
});
|
64
|
+
|