pagarme 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pagarme/resources/postback.rb +1 -1
- data/lib/pagarme/version.rb +1 -1
- data/test/fixtures.rb +1 -1
- data/test/pagarme/resources/postback_test.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 947c7bc9fea07b5bb4b9c89ab75ef72a7691c264
|
4
|
+
data.tar.gz: a6f0985e22ccb24a41e59a9804a04a8e8f3f1fff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5a0a905cd64a05a92445205f3e0b5ebe1e3ed6526fce832bff1ffda03b3bf3c61cdeb5956ba9ea1fae9fda5b0a2cf116765d854c62be0633c99570c942d1b81
|
7
|
+
data.tar.gz: 58eb341a89fee732876a75eb28e62be22654fafd0ff92c69acdc456711c1b4ed82722e5c2c887343ba8dce3cc48948f68a11c7108d48e77fff92a53a4880baad
|
data/lib/pagarme/version.rb
CHANGED
data/test/fixtures.rb
CHANGED
@@ -122,7 +122,7 @@ class Fixtures
|
|
122
122
|
def postback_response
|
123
123
|
{
|
124
124
|
payload: "id=406483&fingerprint=9e9496ef28d1154b2db9a446323db90103069330&event=transaction_status_changed&old_status=processing&desired_status=paid¤t_status=paid&object=transaction&transaction[object]=transaction&transaction[status]=paid&transaction[refuse_reason]=null&transaction[status_reason]=acquirer&transaction[acquirer_response_code]=0&transaction[acquirer_name]=pagarme&transaction[authorization_code]=18051&transaction[soft_descriptor]=null&transaction[tid]=406483&transaction[nsu]=406483&transaction[date_created]=2016-03-03T19:13:31.000Z&transaction[date_updated]=2016-03-03T19:13:32.000Z&transaction[amount]=1000&transaction[authorized_amount]=1000&transaction[paid_amount]=1000&transaction[refunded_amount]=0&transaction[installments]=1&transaction[id]=406483&transaction[cost]=50&transaction[card_holder_name]=Jose da Silva&transaction[card_last_digits]=4448&transaction[card_first_digits]=490172&transaction[card_brand]=visa&transaction[postback_url]=http://example.com/postback/1&transaction[payment_method]=credit_card&transaction[capture_method]=ecommerce&transaction[antifraud_score]=null&transaction[boleto_url]=null&transaction[boleto_barcode]=null&transaction[boleto_expiration_date]=null&transaction[referer]=api_key&transaction[ip]=179.185.132.108&transaction[subscription_id]=null&transaction[phone][object]=phone&transaction[phone][ddi]=55&transaction[phone][ddd]=21&transaction[phone][number]=922334455&transaction[phone][id]=21123&transaction[address][object]=address&transaction[address][street]=Av. Brigadeiro Faria Lima&transaction[address][complementary]=null&transaction[address][street_number]=2941&transaction[address][neighborhood]=Itaim bibi&transaction[address][city]=São Paulo&transaction[address][state]=SP&transaction[address][zipcode]=1452000&transaction[address][country]=Brasil&transaction[address][id]=21810&transaction[customer][object]=customer&transaction[customer][document_number]=84931126235&transaction[customer][document_type]=cpf&transaction[customer][name]=Jose da Silva&transaction[customer][email]=pagarmetestruby@mailinator.com&transaction[customer][born_at]=1970-10-11T00:00:00.000Z&transaction[customer][gender]=M&transaction[customer][date_created]=2016-03-01T18:38:25.000Z&transaction[customer][id]=43304&transaction[card][object]=card&transaction[card][id]=card_cil9rcdql00gmbp6er9i5q48u&transaction[card][date_created]=2016-03-01T18:38:25.000Z&transaction[card][date_updated]=2016-03-01T18:38:29.000Z&transaction[card][brand]=visa&transaction[card][holder_name]=Jose da Silva&transaction[card][first_digits]=490172&transaction[card][last_digits]=4448&transaction[card][country]=BR&transaction[card][fingerprint]=F0Y0+wH0d8DS&transaction[card][customer]=undefined&transaction[card][valid]=true",
|
125
|
-
signature: '57925d5954efd85613bbffa121dc06b4e7737256'
|
125
|
+
signature: 'sha1=57925d5954efd85613bbffa121dc06b4e7737256'
|
126
126
|
}
|
127
127
|
end
|
128
128
|
|
@@ -10,14 +10,14 @@ module PagarMe
|
|
10
10
|
end
|
11
11
|
|
12
12
|
should 'be valid when has invalid signature' do
|
13
|
-
postback = PagarMe::Postback.new postback_response_params(signature: 'invalid signature')
|
13
|
+
postback = PagarMe::Postback.new postback_response_params(signature: 'sha1=invalid signature')
|
14
14
|
assert !postback.valid?
|
15
15
|
end
|
16
16
|
|
17
17
|
should 'validate signature' do
|
18
18
|
params = postback_response_params
|
19
|
-
assert PagarMe::Postback.valid_request_signature?(params[:payload],
|
20
|
-
assert !PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature])
|
19
|
+
assert PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature])
|
20
|
+
assert !PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature][4..-1])
|
21
21
|
assert !PagarMe::Postback.valid_request_signature?(params[:payload], 'invalid signature')
|
22
22
|
end
|
23
23
|
end
|