catarse_pagarme 2.3.3 → 2.3.4
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_pagarme/application.js +2 -2
- data/app/assets/javascripts/catarse_pagarme/credit_card.js +24 -23
- data/app/assets/javascripts/catarse_pagarme/payment_choice.js +1 -1
- data/app/assets/javascripts/catarse_pagarme/payment_slip.js +12 -6
- data/app/views/catarse_pagarme/pagarme/review.html.slim +40 -32
- data/lib/catarse_pagarme/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: 315b7b8b11c7d709767c302bf355e753c1346ef5
|
4
|
+
data.tar.gz: ebb01776bd5b04bbae7063b8896dd8bde25c6f38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ec83dabb18327ec1de2e6d5a401f409012f949d69b7bf342f882726e0fa5c60a806ed9b342266c7ca3c65723ce1899b6b5db58509872bb5c95b16f2a263358c
|
7
|
+
data.tar.gz: 00bf5b62c94f94be37a070aa1742fb62d79618719601113832f4119e6766f79c9b822537f376fb92e491ea70042f79d26b486d796f7e276ad8ee350281353d32
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
App.views.
|
2
|
-
el: '#payment_type_credit_card_section',
|
1
|
+
App.views.Pagarme.addChild('PaymentCard', _.extend({
|
2
|
+
el: '#payment_type_credit_card_section form',
|
3
3
|
|
4
4
|
events: {
|
5
5
|
'keyup input[type="text"]' : 'creditCardInputValidator',
|
6
|
-
'
|
6
|
+
'input #payment_card_number' : 'onKeyupPaymentCardNumber',
|
7
7
|
'click input#credit_card_submit' : 'onSubmit',
|
8
|
-
'change .creditcard-records' : 'onChangeCard'
|
8
|
+
'change .creditcard-records' : 'onChangeCard',
|
9
|
+
'blur input' : 'checkInput'
|
9
10
|
},
|
10
11
|
|
11
12
|
onChangeCard: function(event){
|
@@ -22,9 +23,16 @@ App.views.PagarmeForm.addChild('PaymentCard', {
|
|
22
23
|
|
23
24
|
activate: function(options){
|
24
25
|
var that = this;
|
25
|
-
this.
|
26
|
+
this.setupForm();
|
26
27
|
this.message = this.$('.payment-error-message');
|
27
|
-
this
|
28
|
+
this.formatCreditCardInputs();
|
29
|
+
window.app.maskAllElements();
|
30
|
+
},
|
31
|
+
|
32
|
+
formatCreditCardInputs: function(){
|
33
|
+
this.$('#payment_card_number').payment('formatCardNumber');
|
34
|
+
this.$('#payment_card_date').payment('formatCardExpiry');
|
35
|
+
this.$('#payment_card_source').payment('formatCardCVC');
|
28
36
|
},
|
29
37
|
|
30
38
|
getUrl: function(){
|
@@ -87,8 +95,12 @@ App.views.PagarmeForm.addChild('PaymentCard', {
|
|
87
95
|
|
88
96
|
onSubmit: function(e) {
|
89
97
|
var that = this;
|
90
|
-
|
91
98
|
e.preventDefault();
|
99
|
+
|
100
|
+
if(!this.validate()){
|
101
|
+
return false;
|
102
|
+
}
|
103
|
+
|
92
104
|
$(e.currentTarget).hide();
|
93
105
|
that.parent.loader.show();
|
94
106
|
|
@@ -118,23 +130,12 @@ App.views.PagarmeForm.addChild('PaymentCard', {
|
|
118
130
|
},
|
119
131
|
|
120
132
|
onKeyupPaymentCardNumber: function(e){
|
121
|
-
|
133
|
+
var number = $(e.currentTarget).val();
|
134
|
+
this.$('#payment_card_flag').html(this.getCardFlag(number))
|
122
135
|
},
|
123
136
|
|
124
137
|
getCardFlag: function(number) {
|
125
|
-
var
|
126
|
-
|
127
|
-
if ((/^(34|37)/).test(cc) && cc.length == 15) {
|
128
|
-
return 'AMEX'; //AMEX begins with 34 or 37, and length is 15.
|
129
|
-
} else if ((/^(51|52|53|54|55)/).test(cc) && cc.length == 16) {
|
130
|
-
return 'MASTER'; //MasterCard beigins with 51-55, and length is 16.
|
131
|
-
} else if ((/^(4)/).test(cc) && (cc.length == 13 || cc.length == 16)) {
|
132
|
-
return 'VISA'; //VISA begins with 4, and length is 13 or 16.
|
133
|
-
} else if ((/^(300|301|302|303|304|305|36|38)/).test(cc) && cc.length == 14) {
|
134
|
-
return 'DINERS'; //Diners Club begins with 300-305 or 36 or 38, and length is 14.
|
135
|
-
} else if ((/^(38)/).test(cc) && cc.length == 19) {
|
136
|
-
return 'HIPER';
|
137
|
-
}
|
138
|
-
return '';
|
138
|
+
var flag = $.payment.cardType(number);
|
139
|
+
return flag && flag.toUpperCase();
|
139
140
|
}
|
140
|
-
});
|
141
|
+
}, Skull.Form));
|
@@ -1,13 +1,14 @@
|
|
1
|
-
App.views.
|
2
|
-
el: '#payment_type_slip_section',
|
1
|
+
App.views.Pagarme.addChild('PaymentSlip', _.extend({
|
2
|
+
el: '#payment_type_slip_section form',
|
3
3
|
|
4
4
|
events: {
|
5
5
|
'click input#build_boleto' : 'onBuildBoletoClick',
|
6
6
|
'click .link_content a' : 'onContentClick',
|
7
|
+
'blur input' : 'checkInput'
|
7
8
|
},
|
8
9
|
|
9
10
|
activate: function(options){
|
10
|
-
this.
|
11
|
+
this.setupForm();
|
11
12
|
this.message = this.$('.payment-error-message');
|
12
13
|
this.$('#user_bank_account_attributes_name').brbanks();
|
13
14
|
},
|
@@ -24,12 +25,17 @@ App.views.PagarmeForm.addChild('PaymentSlip', {
|
|
24
25
|
|
25
26
|
onBuildBoletoClick: function(e){
|
26
27
|
var that = this;
|
28
|
+
|
29
|
+
if(!this.validate()){
|
30
|
+
return false;
|
31
|
+
}
|
32
|
+
|
27
33
|
var parent = this.parent;
|
28
34
|
|
29
35
|
e.preventDefault();
|
30
36
|
$(e.currentTarget).hide();
|
31
37
|
this.$('#payment-slip-instructions').slideUp('slow');
|
32
|
-
that.
|
38
|
+
that.parent.loader.show();
|
33
39
|
|
34
40
|
var bankAccountAttributes = {
|
35
41
|
user: {
|
@@ -45,7 +51,7 @@ App.views.PagarmeForm.addChild('PaymentSlip', {
|
|
45
51
|
}
|
46
52
|
};
|
47
53
|
|
48
|
-
$.post('/payment/pagarme/'+that.
|
54
|
+
$.post('/payment/pagarme/'+that.parent.contributionId+'/pay_slip', bankAccountAttributes).success(function(response){
|
49
55
|
parent.loader.hide();
|
50
56
|
if(response.payment_status == 'failed'){
|
51
57
|
that.message.find('.message-text').html(response.message);
|
@@ -62,4 +68,4 @@ App.views.PagarmeForm.addChild('PaymentSlip', {
|
|
62
68
|
});
|
63
69
|
}
|
64
70
|
|
65
|
-
});
|
71
|
+
}, Skull.Form));
|
@@ -1,21 +1,21 @@
|
|
1
1
|
= javascript_include_tag 'catarse_pagarme'
|
2
2
|
#catarse_pagarme_form
|
3
|
-
= form_tag 'javascript:void(0);', :class => 'pagarme' do
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
4
|
+
.next_step_after_valid_document
|
5
|
+
.w-row.list_payment.w-form
|
6
|
+
.w-col.w-col-7.w-col-small-7.back-payment-moip-options-column
|
7
|
+
.w-radio.w-clearfix
|
8
|
+
= radio_button_tag 'payment_type', "credit_card", false, class: 'w-radio-input back-payment-radio-button'
|
9
|
+
= label_tag :payment_type_credit_card, nil, class: "cards w-form-label" do
|
10
|
+
= image_tag 'catarse_bootstrap/payment_cards_pagarme.png'
|
11
|
+
.w-col.w-col-5.w-col-small-5.back-payment-moip-options-column
|
12
|
+
.w-radio.w-clearfix
|
13
|
+
= radio_button_tag 'payment_type', "slip", false, class: 'w-radio-input back-payment-radio-button'
|
14
|
+
= label_tag :payment_type_slip, class: "boleto w-form-label" do
|
15
|
+
= image_tag 'catarse_bootstrap/payment_boleto.png'
|
17
16
|
|
18
|
-
|
17
|
+
#payment_type_credit_card_section.payment_section
|
18
|
+
= form_tag 'javascript:void(0);', :class => 'pagarme' do
|
19
19
|
div[class="my-credit-cards w-form back-payment-form-creditcard records-choice #{(current_user.credit_cards.present? ? '' : 'w-hidden')}"]
|
20
20
|
- current_user.credit_cards.each_with_index do |credit_card, i|
|
21
21
|
.w-row.creditcard-records
|
@@ -43,25 +43,33 @@
|
|
43
43
|
.w-col.w-col-12
|
44
44
|
.field-label.fontweight-semibold
|
45
45
|
= label_tag :payment_card_name, t('projects.contributions.edit.form_labels.payment_card_name'), class: 'field-label fontweight-semibold'
|
46
|
-
= text_field_tag :payment_card_name, nil, class: 'w-input text-field'
|
46
|
+
= text_field_tag :payment_card_name, nil, class: 'w-input text-field', required: true
|
47
|
+
.fontsize-smaller.text-error.u-marginbottom-20.fa.fa-exclamation-triangle.w-hidden[data-error-for="payment_card_name"]
|
48
|
+
| Por favor digite o nome escrito no cartão
|
47
49
|
.w-row
|
48
50
|
.w-col.w-col-6.w-sub-col
|
49
51
|
= label_tag :payment_card_number, t('projects.contributions.edit.form_labels.payment_card_number'), class: 'fontweight-semibold field-label'
|
50
52
|
.w-row
|
51
53
|
.w-col.w-col-9.w-col-small-9.w-col-tiny-9
|
52
|
-
=
|
54
|
+
= phone_field_tag :payment_card_number, nil, class: 'w-input text-field prefix', required: true
|
53
55
|
.w-col.w-col-3.w-col-small-3.w-col-tiny-3.text-field.postfix.no-hover
|
54
56
|
#payment_card_flag.fontsize-smallest.fontcolor-secondary.u-text-center
|
55
57
|
|
|
58
|
+
.fontsize-smaller.text-error.u-marginbottom-20.fa.fa-exclamation-triangle.w-hidden[data-error-for="payment_card_number"]
|
59
|
+
| Por favor verifique o número do cartão de crédito
|
56
60
|
.w-col.w-col-6
|
57
61
|
.w-row
|
58
62
|
.w-col.w-col-6.w-col-small-6.w-col-tiny-6.w-sub-col-middle
|
59
63
|
= label_tag :payment_card_source, t('projects.contributions.edit.form_labels.payment_card_source'), class: 'field-label fontweight-semibold w-hidden-medium'
|
60
64
|
= label_tag :payment_card_source, t('projects.contributions.edit.form_labels.payment_card_source_short'), class: 'field-label fontweight-semibold w-hidden-main w-hidden-small w-hidden-tiny'
|
61
|
-
=
|
65
|
+
= phone_field_tag :payment_card_source, nil, class: 'w-input text-field', required: true
|
66
|
+
.fontsize-smaller.text-error.u-marginbottom-20.fa.fa-exclamation-triangle.w-hidden[data-error-for="payment_card_source"]
|
67
|
+
| Veja o código de segurança do cartão abaixo da tarja magnética
|
62
68
|
.w-col.w-col-6.w-col-small-6.w-col-tiny-6
|
63
69
|
= label_tag :payment_card_date, t('projects.contributions.edit.form_labels.payment_card_date'), class: 'field-label fontweight-semibold'
|
64
|
-
=
|
70
|
+
= phone_field_tag :payment_card_date, nil, class: 'w-input text-field', required: true
|
71
|
+
.fontsize-smaller.text-error.u-marginbottom-20.fa.fa-exclamation-triangle.w-hidden[data-error-for="payment_card_date"]
|
72
|
+
| Qual a data de expiração no cartão?
|
65
73
|
- if @contribution.value.to_f >= CatarsePagarme.configuration.minimum_value_for_installment.to_f
|
66
74
|
.w-row
|
67
75
|
.w-col.w-col-6.w-sub-col
|
@@ -81,23 +89,23 @@
|
|
81
89
|
= submit_tag t('projects.contributions.review.form.labels.submit'), :class => 'btn btn-large u-marginbottom-20', :id => "credit_card_submit"
|
82
90
|
= render partial: 'terms'
|
83
91
|
|
84
|
-
|
92
|
+
#payment_type_slip_section.payment_section.w-hidden
|
93
|
+
= simple_form_for current_user, url: 'javascript:void(0)' do |f|
|
85
94
|
.card.card-message.u-radius.zindex-10.fontsize-small.u-marginbottom-30
|
86
95
|
= t('projects.contributions.edit.payment_slip_disclaimer')
|
87
96
|
.formwrapper
|
88
|
-
|
89
|
-
.
|
90
|
-
|
91
|
-
.w-
|
92
|
-
|
93
|
-
.w-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
.w-
|
99
|
-
|
100
|
-
= bank_form.input :owner_document, as: :string, input_html: { value: bank_form.object.owner_document || current_user.cpf }, wrapper_html: {class: 'w-col w-col-6'}
|
97
|
+
.bank_accounts
|
98
|
+
= f.simple_fields_for :bank_account do |bank_form|
|
99
|
+
.w-row
|
100
|
+
= bank_form.input :bank_id, as: :select, collection: Bank.order(:code, :name).to_collection, wrapper_html: {class: 'w-col w-col-12'}, input_html: {required: true}, validation_text: true
|
101
|
+
.w-row
|
102
|
+
= bank_form.input :agency, as: :tel, wrapper_html: {class: 'w-col w-sub-col-middle w-col-4 w-col-small-8 w-col-tiny-8'}, input_html: {required: true}, validation_text: true
|
103
|
+
= bank_form.input :agency_digit, as: :tel, wrapper_html: {class: 'w-col w-sub-col-middle w-sub-col w-col-2 w-col-small-4 w-col-tiny-4'}
|
104
|
+
= bank_form.input :account, as: :tel, wrapper_html: {class: 'w-col w-sub-col-middle w-col-4 w-col-small-8 w-col-tiny-8'}, input_html: {required: true}, validation_text: true
|
105
|
+
= bank_form.input :account_digit, as: :tel, wrapper_html: {class: 'w-col w-col-2 w-col-small-4 w-col-tiny-4'}, input_html: {required: true}, validation_text: true
|
106
|
+
.w-row
|
107
|
+
= bank_form.input :owner_name, as: :string, input_html: { required: true, value: bank_form.object.owner_name || current_user.full_name }, wrapper_html: {class: 'w-col w-sub-col w-col-6'}, validation_text: true
|
108
|
+
= bank_form.input :owner_document, as: :tel, input_html: { required: true, value: bank_form.object.owner_document || current_user.cpf }, wrapper_html: {class: 'w-col w-col-6'}, validation_text: true
|
101
109
|
.w-row
|
102
110
|
.w-col.w-col-12
|
103
111
|
.payment-error-message.card.card-error.u-radius.zindex-10.u-marginbottom-30.w-hidden
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: catarse_pagarme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antônio Roberto Silva
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|