mymoip 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/mymoip/credit_card.rb +9 -2
- data/lib/mymoip/credit_card_payment.rb +1 -1
- data/lib/mymoip/request.rb +1 -1
- data/mymoip.gemspec +2 -2
- data/test/fixtures/fixture.rb +1 -1
- data/test/fixtures/vcr_cassettes/payment_request.yml +7 -7
- data/test/fixtures/vcr_cassettes/transparent_request.yml +5 -4
- data/test/test_credit_card_payment.rb +1 -1
- data/test/test_creditcard.rb +12 -2
- data/test/test_payment_request.rb +1 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
+
**0.2.6**
|
5
|
+
* Deprecate owner_rg attribute of MyMoip::CreditCard; you should provide a owner_cpf from now on. Should explain issues with Visa's risk analysis.
|
6
|
+
|
4
7
|
**0.2.5**
|
5
8
|
* Request's log messages moved to debug level.
|
6
9
|
* Make CreditCard class accept string and symbol logos.
|
data/README.md
CHANGED
@@ -72,7 +72,7 @@ credit_card = MyMoip::CreditCard.new(
|
|
72
72
|
owner_name: "Juquinha da Rocha",
|
73
73
|
owner_birthday: Date.new(1984, 11, 3),
|
74
74
|
owner_phone: "(51)3040-5060",
|
75
|
-
|
75
|
+
owner_cpf: "522.116.706-95"
|
76
76
|
)
|
77
77
|
|
78
78
|
credit_card_payment = MyMoip::CreditCardPayment.new(credit_card, installments: 1)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
data/lib/mymoip/credit_card.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module MyMoip
|
2
2
|
class CreditCard
|
3
3
|
attr_accessor :logo, :card_number, :expiration_date, :security_code,
|
4
|
-
:owner_name, :owner_birthday, :owner_phone, :
|
4
|
+
:owner_name, :owner_birthday, :owner_phone, :owner_cpf
|
5
5
|
|
6
6
|
AVAILABLE_LOGOS = [
|
7
7
|
:american_express, :diners, :hipercard, :mastercard, :visa
|
@@ -15,7 +15,14 @@ module MyMoip
|
|
15
15
|
@owner_name = params[:owner_name] if params.has_key? :owner_name
|
16
16
|
@owner_birthday = params[:owner_birthday] if params.has_key? :owner_birthday
|
17
17
|
@owner_phone = params[:owner_phone] if params.has_key? :owner_phone
|
18
|
-
@
|
18
|
+
@owner_cpf = params[:owner_cpf] if params.has_key? :owner_cpf
|
19
|
+
|
20
|
+
self.owner_rg = params[:owner_rg] if params.has_key? :owner_rg
|
21
|
+
end
|
22
|
+
|
23
|
+
def owner_rg=(value)
|
24
|
+
warn "[DEPRECATION] `owner_rg` is deprecated. Please use `owner_cpf` instead."
|
25
|
+
self.owner_cpf = value
|
19
26
|
end
|
20
27
|
end
|
21
28
|
end
|
data/lib/mymoip/request.rb
CHANGED
data/mymoip.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "mymoip"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Irio Irineu Musskopf Junior"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-11-13"
|
13
13
|
s.description = "Provides a implementation of MoIP's transparent checkout."
|
14
14
|
s.email = "irio.musskopf@caixadeideias.com.br"
|
15
15
|
s.extra_rdoc_files = [
|
data/test/fixtures/fixture.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://YOUR_MOIP_TOKEN:YOUR_MOIP_KEY@desenvolvedor.moip.com.br/sandbox/rest/pagamento?callback=?&pagamentoWidget=%7B%22pagamentoWidget%22:%7B%22referer%22:%22http://localhost/default%22,%22token%22:%
|
5
|
+
uri: https://YOUR_MOIP_TOKEN:YOUR_MOIP_KEY@desenvolvedor.moip.com.br/sandbox/rest/pagamento?callback=?&pagamentoWidget=%7B%22pagamentoWidget%22:%7B%22referer%22:%22http://localhost/default%22,%22token%22:%22D2O0U1W2K1P1D1R2C2E3H0N3L5X3A2E4E3X0X030T090T0A1D1V2T8X500E3%22,%22dadosPagamento%22:%7B%22Forma%22:%22CartaoCredito%22,%22Parcelas%22:1,%22CartaoCredito%22:%7B%22Numero%22:%224916654211627608%22,%22Expiracao%22:%2206/15%22,%22CodigoSeguranca%22:%22000%22,%22Portador%22:%7B%22Nome%22:%22Juquinha%20da%20Rocha%22,%22DataNascimento%22:%2203/11/1984%22,%22Telefone%22:%22(51)3040-5060%22,%22Identidade%22:%22522.116.706-95%22%7D%7D,%22Instituicao%22:%22Visa%22,%22Recebimento%22:%22AVista%22%7D%7D%7D
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -13,11 +13,11 @@ http_interactions:
|
|
13
13
|
message: OK
|
14
14
|
headers:
|
15
15
|
Date:
|
16
|
-
-
|
16
|
+
- Tue, 13 Nov 2012 01:03:56 GMT
|
17
17
|
Server:
|
18
18
|
- Apache/2.2.23 (CentOS)
|
19
19
|
Content-Length:
|
20
|
-
- '
|
20
|
+
- '272'
|
21
21
|
Vary:
|
22
22
|
- Accept-Encoding
|
23
23
|
Content-Type:
|
@@ -29,9 +29,9 @@ http_interactions:
|
|
29
29
|
b3JubyI6IiIsIlRheGFNb0lQIjoiMTUuMTkiLCJTdGF0dXNQYWdhbWVudG8i
|
30
30
|
OiJTdWNlc3NvIiwiQ2xhc3NpZmljYWNhbyI6eyJDb2RpZ28iOjk5OSwiRGVz
|
31
31
|
Y3JpY2FvIjoiTsOjbyBzdXBvcnRhZG8gbm8gYW1iaWVudGUgU2FuZGJveCJ9
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
LCJDb2RpZ29Nb0lQIjoxMDI1OTYsIk1lbnNhZ2VtIjoiUmVxdWlzacOnw6Nv
|
33
|
+
IHByb2Nlc3NhZGEgY29tIHN1Y2Vzc28iLCJUb3RhbFBhZ28iOiIyMDAuMDAi
|
34
|
+
fSk=
|
35
35
|
http_version:
|
36
|
-
recorded_at:
|
36
|
+
recorded_at: Tue, 13 Nov 2012 01:01:06 GMT
|
37
37
|
recorded_with: VCR 2.2.5
|
@@ -6,7 +6,8 @@ http_interactions:
|
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: <EnviarInstrucao><InstrucaoUnica TipoValidacao="Transparente"><Razao>some
|
9
|
-
payment_reason</Razao><Valores><Valor moeda="BRL">100.00</Valor><Valor moeda="BRL">200.00</Valor></Valores><IdProprio>
|
9
|
+
payment_reason</Razao><Valores><Valor moeda="BRL">100.00</Valor><Valor moeda="BRL">200.00</Valor></Valores><IdProprio>my_new_instruction_id</IdProprio><Pagador><Nome>Juquinha
|
10
|
+
da Rocha</Nome><Email>juquinha@rocha.com</Email><IdPagador>your_own_payer_id</IdPagador><EnderecoCobranca><Logradouro>Felipe
|
10
11
|
Neri</Logradouro><Numero>406</Numero><Complemento>Sala 501</Complemento><Bairro>Auxiliadora</Bairro><Cidade>Porto
|
11
12
|
Alegre</Cidade><Estado>RS</Estado><Pais>BRA</Pais><CEP>90440-150</CEP><TelefoneFixo>(51)3040-5060</TelefoneFixo></EnderecoCobranca></Pagador></InstrucaoUnica></EnviarInstrucao>
|
12
13
|
headers: {}
|
@@ -16,7 +17,7 @@ http_interactions:
|
|
16
17
|
message: OK
|
17
18
|
headers:
|
18
19
|
Date:
|
19
|
-
-
|
20
|
+
- Tue, 13 Nov 2012 01:03:52 GMT
|
20
21
|
Server:
|
21
22
|
- Apache/2.2.23 (CentOS)
|
22
23
|
Content-Length:
|
@@ -27,7 +28,7 @@ http_interactions:
|
|
27
28
|
- text/xml;charset=UTF-8
|
28
29
|
body:
|
29
30
|
encoding: US-ASCII
|
30
|
-
string: <ns1:EnviarInstrucaoUnicaResponse xmlns:ns1="http://www.moip.com.br/ws/alpha/"><Resposta><ID>201210171118501100000001102691</ID><Status>Sucesso</Status><Token>
|
31
|
+
string: <ns1:EnviarInstrucaoUnicaResponse xmlns:ns1="http://www.moip.com.br/ws/alpha/"><Resposta><ID>201210171118501100000001102691</ID><Status>Sucesso</Status><Token>D2O0U1W2K1P1D1R2C2E3H0N3L5X3A2E4E3X0X030T090T0A1D1V2T8X500E3</Token></Resposta></ns1:EnviarInstrucaoUnicaResponse>
|
31
32
|
http_version:
|
32
|
-
recorded_at:
|
33
|
+
recorded_at: Tue, 13 Nov 2012 01:01:02 GMT
|
33
34
|
recorded_with: VCR 2.2.5
|
@@ -49,7 +49,7 @@ class TestCreditCardPayment < Test::Unit::TestCase
|
|
49
49
|
MyMoip::CreditCard.any_instance.stubs(:owner_birthday).returns(original_date)
|
50
50
|
assert_equal original_date.strftime("%d/%m/%Y"), payment.to_json[:CartaoCredito][:Portador][:DataNascimento]
|
51
51
|
assert_match /\A\(\d{2}\)\d{4,5}-\d{4}/, payment.to_json[:CartaoCredito][:Portador][:Telefone]
|
52
|
-
assert_match /\A\d
|
52
|
+
assert_match /\A\d{3}\.\d{3}\.\d{3}\-\d{2}\z/, payment.to_json[:CartaoCredito][:Portador][:Identidade]
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_to_json_should_accept_any_creditcard_from_available_logos_constant
|
data/test/test_creditcard.rb
CHANGED
@@ -11,7 +11,7 @@ class TestCreditCard < Test::Unit::TestCase
|
|
11
11
|
owner_name: "Juquinha da Rocha",
|
12
12
|
owner_birthday: Date.new(1984, 11, 3),
|
13
13
|
owner_phone: "(51)3040-5060",
|
14
|
-
|
14
|
+
owner_cpf: "522.116.706-95"
|
15
15
|
)
|
16
16
|
|
17
17
|
assert_equal :visa, subject.logo
|
@@ -21,7 +21,17 @@ class TestCreditCard < Test::Unit::TestCase
|
|
21
21
|
assert_equal "Juquinha da Rocha", subject.owner_name
|
22
22
|
assert_equal Date.new(1984, 11, 3), subject.owner_birthday
|
23
23
|
assert_equal "(51)3040-5060", subject.owner_phone
|
24
|
-
assert_equal "
|
24
|
+
assert_equal "522.116.706-95", subject.owner_cpf
|
25
25
|
end
|
26
26
|
|
27
|
+
def test_warns_about_owner_rg_attribute_deprecation_on_initialization
|
28
|
+
MyMoip::CreditCard.any_instance.expects(:warn).with(regexp_matches(/is deprecated/))
|
29
|
+
subject = Fixture.credit_card(owner_rg: '1010202030')
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_warns_about_owner_rg_attribute_deprecation_on_setter
|
33
|
+
subject = Fixture.credit_card
|
34
|
+
subject.expects(:warn).with(regexp_matches(/is deprecated/))
|
35
|
+
subject.owner_rg = '1010202030'
|
36
|
+
end
|
27
37
|
end
|
@@ -81,7 +81,7 @@ class TestPaymentRequest < Test::Unit::TestCase
|
|
81
81
|
VCR.use_cassette('payment_request') do
|
82
82
|
payment_request.api_call(credit_card_payment, token: transparent_request.token)
|
83
83
|
end
|
84
|
-
assert_equal
|
84
|
+
assert_equal 102596, payment_request.code
|
85
85
|
end
|
86
86
|
|
87
87
|
def test_code_method_should_return_nil_with_blank_response
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mymoip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|
@@ -209,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
209
|
version: '0'
|
210
210
|
segments:
|
211
211
|
- 0
|
212
|
-
hash:
|
212
|
+
hash: 1339834329601628158
|
213
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
214
|
none: false
|
215
215
|
requirements:
|