pagarme 1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- data/Gemfile.lock +1 -1
- data/lib/pagarme/transaction_common.rb +1 -1
- data/pagarme.gemspec +1 -1
- data/test/pagarme/pagarme.rb +10 -0
- data/test/test_helper.rb +20 -17
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmE0M2Q2YmY0ZDcyNmNkZjcyMWIzYTA2NzhhM2NmZjJlODcwOTc2NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
7
|
-
|
6
|
+
ZDM3NzQyNDQ1NjhlZmFiNGIyMzQyNWI2Y2MyZDc1NmZjNzMwMTE2MQ==
|
7
|
+
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Njg1OTYyY2YxOGM4Y2QwMjE5N2QxNmMxZWFiMGEwNTQ0ZDU4MDc1MTk4NGVm
|
10
|
+
MWUyYjViNTE1ZDRkNDU3M2ZlMmMwMjcyNmMzNDkyMDY4YWVhNDFhZDEwNGMy
|
11
|
+
N2RiOTI4MzcwYTY0MjE2NTgyMDU2ZGMxNDFkNzJhYTZmOTNlMDQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzlhYzhlNTE3Mjc4NzcwNmNhZmFjZTFmNDcyZDNlYjNjZDExYWYxOWZlMjgx
|
14
|
+
NDcxZTNiMTI1NDhiZTY1ZmZkMjhiNDMzYjkwNmFmYjVmZmNiZmQ4ZWQ1Njg5
|
15
|
+
MzcyMjY2OTk2OTExYjhiYzU1YjQ0NmIxNmFlYWYwMGNjODRlOGQ=
|
data/Gemfile.lock
CHANGED
@@ -27,7 +27,7 @@ module PagarMe
|
|
27
27
|
def validate
|
28
28
|
error = PagarMeError.new
|
29
29
|
if self.payment_method == 'credit_card'
|
30
|
-
if !self.card_number || self.card_number.to_s.length
|
30
|
+
if !self.card_number || self.card_number.to_s.length > 20 || !is_valid_credit_card(self.card_number.to_s)
|
31
31
|
error.errors << PagarMeError.new("Número do cartão inválido.", 'card_number')
|
32
32
|
end
|
33
33
|
if !self.card_holder_name || !self.card_holder_name || self.card_holder_name.length == 0
|
data/pagarme.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "pagarme"
|
7
|
-
spec.version = 1.
|
7
|
+
spec.version = 1.2
|
8
8
|
spec.authors = ["Pedro Franceschi", "Henrique Dubugras"]
|
9
9
|
spec.email = ["pedrohfranceschi@gmail.com", "henrique@pagar.me"]
|
10
10
|
spec.description = %q{Pagar.me's ruby gem}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require_relative '../test_helper'
|
3
|
+
|
4
|
+
module PagarMe
|
5
|
+
class PagarMeTest < Test::Unit::TestCase
|
6
|
+
should 'validate fingerprint correctly' do
|
7
|
+
assert PagarMe::validate_fingerprint(123, Digest::SHA1.hexdigest( "123" + "#" + PagarMe::api_key)) == true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -15,14 +15,16 @@ end
|
|
15
15
|
|
16
16
|
def test_subscription_without_plan(params = {})
|
17
17
|
return PagarMe::Subscription.new({
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
:payment_method => 'credit_card',
|
19
|
+
:card_number => "4901720080344448",
|
20
|
+
:card_holder_name => "Jose da Silva",
|
21
|
+
:card_expiration_month => "10",
|
22
|
+
:card_expiration_year => "15",
|
23
|
+
:card_cvv => "314",
|
24
|
+
:postback_url => "http://test.com/postback",
|
25
|
+
:customer => {
|
26
|
+
:email => 'customer@pagar.me'
|
27
|
+
}
|
26
28
|
}.merge(params))
|
27
29
|
end
|
28
30
|
|
@@ -38,14 +40,16 @@ end
|
|
38
40
|
|
39
41
|
def test_subscription(params = {})
|
40
42
|
return PagarMe::Subscription.new({
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
:payment_method => 'credit_card',
|
44
|
+
:card_number => "4901720080344448",
|
45
|
+
:card_holder_name => "Jose da Silva",
|
46
|
+
:card_expiration_month => "10",
|
47
|
+
:card_expiration_year => "15",
|
48
|
+
:card_cvv => "314",
|
49
|
+
:postback_url => "http://test.com/postback",
|
50
|
+
:customer => {
|
51
|
+
email: 'customer@pagar.me'
|
52
|
+
}
|
49
53
|
}.merge(params))
|
50
54
|
end
|
51
55
|
|
@@ -85,7 +89,6 @@ def test_subscription_with_customer(params = {})
|
|
85
89
|
:card_expiration_month => 11,
|
86
90
|
:card_expiration_year => 14,
|
87
91
|
:card_cvv => 356,
|
88
|
-
:customer_email => 'teste@teste.com',
|
89
92
|
:customer => {
|
90
93
|
:name => "Jose da Silva",
|
91
94
|
:document_number => "36433809847",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagarme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Franceschi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- lib/pagarme/util.rb
|
126
126
|
- pagarme.gemspec
|
127
127
|
- pagarme.rb
|
128
|
+
- test/pagarme/pagarme.rb
|
128
129
|
- test/pagarme/plan.rb
|
129
130
|
- test/pagarme/subscription.rb
|
130
131
|
- test/pagarme/transaction.rb
|
@@ -148,11 +149,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
149
|
version: '0'
|
149
150
|
requirements: []
|
150
151
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.0
|
152
|
+
rubygems_version: 2.2.0
|
152
153
|
signing_key:
|
153
154
|
specification_version: 4
|
154
155
|
summary: Allows integration with Pagar.me
|
155
156
|
test_files:
|
157
|
+
- test/pagarme/pagarme.rb
|
156
158
|
- test/pagarme/plan.rb
|
157
159
|
- test/pagarme/subscription.rb
|
158
160
|
- test/pagarme/transaction.rb
|