paymill_on_rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cb7d1bdd44441cd079562571a74035e30f0d33a
|
4
|
+
data.tar.gz: ad6e688d1a336bbb30f6ac0fac147f0af4c393c8
|
5
5
|
!binary "U0hBNTEy":
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59ffad7fb154238a13856846f0a957ceb64af6a470ba7b6d3e73bcbbf5cc6a51bd1e4818b8ce7fbf8b8f2f3c1af94dabfe110db048d05fd5c715569a45e76ee8
|
7
|
+
data.tar.gz: 661c35e50dd49381701340b932d13c8f2294cd1802ee327d65c5a7eff7b8bcf82773c2cd49f536926a8f18683fd88468ea38528ae0cea7a603355d3c8cebbd8d
|
@@ -7,7 +7,12 @@
|
|
7
7
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
8
|
// compiled file.
|
9
9
|
//
|
10
|
-
//
|
11
|
-
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
12
|
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require twitter/bootstrap
|
16
|
+
//= require turbolinks
|
13
17
|
//= require_tree .
|
18
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
var subscription;
|
2
|
+
|
3
|
+
jQuery(function() {
|
4
|
+
return subscription.setupForm();
|
5
|
+
});
|
6
|
+
|
7
|
+
subscription = {
|
8
|
+
setupForm: function() {
|
9
|
+
return $('#new_subscription').submit(function() {
|
10
|
+
$('input[type=submit]').attr('disabled', true);
|
11
|
+
if ($('#card_number').length) {
|
12
|
+
subscription.processCard();
|
13
|
+
return false;
|
14
|
+
} else {
|
15
|
+
return true;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
},
|
19
|
+
processCard: function() {
|
20
|
+
var card;
|
21
|
+
card = {
|
22
|
+
number: $('#card_number').val(),
|
23
|
+
cvc: $('#card_code').val(),
|
24
|
+
exp_month: $('#card_month').val(),
|
25
|
+
exp_year: $('#card_year').val()
|
26
|
+
};
|
27
|
+
return paymill.createToken(card, subscription.handlePaymillResponse);
|
28
|
+
},
|
29
|
+
handlePaymillResponse: function(error, result) {
|
30
|
+
if (error) {
|
31
|
+
$('#paymill_error').text(error.apierror);
|
32
|
+
return $('input[type=submit]').attr('disabled', false);
|
33
|
+
} else {
|
34
|
+
$('#subscription_paymill_card_token').val(result.token);
|
35
|
+
return $('#new_subscription')[0].submit();
|
36
|
+
}
|
37
|
+
}
|
38
|
+
};
|
39
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paymill_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca G. Soave
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -80,9 +80,9 @@ files:
|
|
80
80
|
- app/assets/stylesheets/paymill_on_rails/application.css
|
81
81
|
- app/assets/stylesheets/paymill_on_rails/plans.css
|
82
82
|
- app/assets/stylesheets/paymill_on_rails/subscriptions.css
|
83
|
+
- app/assets/javascripts/paymill_on_rails/subscriptions.js
|
83
84
|
- app/assets/javascripts/paymill_on_rails/application.js
|
84
85
|
- app/assets/javascripts/paymill_on_rails/plans.js
|
85
|
-
- app/assets/javascripts/paymill_on_rails/subscriptions.js.coffee
|
86
86
|
- app/controllers/paymill_on_rails/plans_controller.rb
|
87
87
|
- app/controllers/paymill_on_rails/application_controller.rb
|
88
88
|
- app/controllers/paymill_on_rails/subscriptions_controller.rb
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# Place all the behaviors and hooks related to the matching controller here.
|
2
|
-
# All this logic will automatically be available in application.js.
|
3
|
-
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
4
|
-
jQuery ->
|
5
|
-
subscription.setupForm()
|
6
|
-
|
7
|
-
subscription =
|
8
|
-
setupForm: ->
|
9
|
-
$('#new_subscription').submit ->
|
10
|
-
$('input[type=submit]').attr('disabled', true)
|
11
|
-
if $('#card_number').length
|
12
|
-
subscription.processCard()
|
13
|
-
false
|
14
|
-
else
|
15
|
-
true
|
16
|
-
|
17
|
-
processCard: ->
|
18
|
-
card =
|
19
|
-
number: $('#card_number').val()
|
20
|
-
cvc: $('#card_code').val()
|
21
|
-
exp_month: $('#card_month').val()
|
22
|
-
exp_year: $('#card_year').val()
|
23
|
-
paymill.createToken(card, subscription.handlePaymillResponse)
|
24
|
-
|
25
|
-
handlePaymillResponse: (error, result) ->
|
26
|
-
if error
|
27
|
-
$('#paymill_error').text(error.apierror)
|
28
|
-
$('input[type=submit]').attr('disabled', false)
|
29
|
-
else
|
30
|
-
$('#subscription_paymill_card_token').val(result.token)
|
31
|
-
$('#new_subscription')[0].submit()
|
32
|
-
|