mymoip 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +19 -26
- data/VERSION +1 -1
- data/lib/mymoip/commission.rb +2 -2
- data/lib/mymoip/credit_card_payment.rb +2 -2
- data/lib/mymoip/exceptions.rb +11 -0
- data/lib/mymoip/instruction.rb +3 -3
- data/mymoip.gemspec +3 -2
- data/test/test_commission.rb +2 -2
- data/test/test_credit_card_payment.rb +2 -2
- data/test/test_instruction.rb +5 -5
- data/test/test_mymoip.rb +0 -1
- data/test/test_payment_request.rb +0 -2
- data/test/test_request.rb +0 -1
- data/test/test_transparent_request.rb +0 -1
- metadata +4 -3
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
CHANGELOG
|
2
|
-
=========
|
1
|
+
# CHANGELOG
|
3
2
|
|
4
|
-
0.
|
5
|
-
|
3
|
+
## 0.5.0
|
4
|
+
* Breaking backward compatibility with exceptions raised. ArgumentError
|
5
|
+
is not used anymore. New MyMoip::InvalidComission, MyMoip::InvalidCreditCard,
|
6
|
+
MyMoip::InvalidInstruction and MyMoip::InvalidPayer exceptions inherited from
|
7
|
+
MyMoip::Error.
|
8
|
+
|
9
|
+
## 0.4.1
|
6
10
|
|
7
11
|
* Simultaneous setters for sandbox and production token/keys.
|
8
12
|
* DEPRECATE MyMoip.key and MyMoip.token methods over new environment specific setters.
|
9
13
|
* Going alive instructions added to README file.
|
10
14
|
* Add reference to new my_moip-rails gem.
|
11
15
|
|
12
|
-
0.4.0
|
13
|
-
-----
|
16
|
+
## 0.4.0
|
14
17
|
|
15
18
|
* Accept multiple receivers for each instruction.
|
16
19
|
* Can set a fixed value (e.g. R$ 50,00).
|
@@ -18,13 +21,11 @@ CHANGELOG
|
|
18
21
|
* Define which one will take the fees.
|
19
22
|
* Accept payments to any MoIP users, even those without API keys.
|
20
23
|
|
21
|
-
0.3.1
|
22
|
-
-----
|
24
|
+
## 0.3.1
|
23
25
|
|
24
26
|
* Re-releasing 0.3.0 after some Rubygems issues.
|
25
27
|
|
26
|
-
0.3.0
|
27
|
-
-----
|
28
|
+
## 0.3.0
|
28
29
|
|
29
30
|
* Add dependency of active_model gem for validations.
|
30
31
|
* Try always to store the plain value of attributes. While the previous version would require you to provide phones in the `"(51)93040-5060"` format, now works even with `"051930405060"`.
|
@@ -50,48 +51,40 @@ New validations:
|
|
50
51
|
* Validate length of address_cep in 8 chars.
|
51
52
|
* Validate length of address_phone (accepts 8 and 9 digit phones with its DDD code).
|
52
53
|
|
53
|
-
0.2.6
|
54
|
-
-----
|
54
|
+
## 0.2.6
|
55
55
|
|
56
56
|
* DEPRECATE owner_rg attribute of MyMoip::CreditCard; you should provide a owner_cpf from now on. Should explain issues with Visa's risk analysis.
|
57
57
|
|
58
|
-
0.2.5
|
59
|
-
-----
|
58
|
+
## 0.2.5
|
60
59
|
|
61
60
|
* Request's log messages moved to debug level.
|
62
61
|
* Make CreditCard class accept string and symbol logos.
|
63
62
|
* Create MyMoip::CreditCard::AVAILABLE_LOGOS constant.
|
64
63
|
* Standardise Request#api_call parameters.
|
65
64
|
|
66
|
-
0.2.4
|
67
|
-
-----
|
65
|
+
## 0.2.4
|
68
66
|
|
69
67
|
* Fix American Express logo format expected by Moip.
|
70
68
|
|
71
|
-
0.2.3
|
72
|
-
-----
|
69
|
+
## 0.2.3
|
73
70
|
|
74
71
|
* Remove .rvmrc
|
75
72
|
* CreditCardPayment's initialization can now receive a hash of options.
|
76
73
|
* lib/requests folder created.
|
77
74
|
* Requests has methods to return its response id.
|
78
75
|
|
79
|
-
0.2.2
|
80
|
-
-----
|
76
|
+
## 0.2.2
|
81
77
|
|
82
78
|
* Explicitly require order for Requests classes.
|
83
79
|
|
84
|
-
0.2.1
|
85
|
-
-----
|
80
|
+
## 0.2.1
|
86
81
|
|
87
82
|
* Bugfix related to explicitly require MyMoip class being needed.
|
88
83
|
|
89
|
-
0.2.0
|
90
|
-
-----
|
84
|
+
## 0.2.0
|
91
85
|
|
92
86
|
* Update production url from `https://desenvolvedor.moip.com.br` to `https://www.moip.com.br`.
|
93
87
|
|
94
|
-
0.1.0
|
95
|
-
-----
|
88
|
+
## 0.1.0
|
96
89
|
|
97
90
|
* First version of the gem.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/lib/mymoip/commission.rb
CHANGED
@@ -26,12 +26,12 @@ module MyMoip
|
|
26
26
|
elsif percentage_value
|
27
27
|
percentage_value * instruction.gross_amount
|
28
28
|
else
|
29
|
-
raise
|
29
|
+
raise InvalidComission, 'Cannot give gross_amount without fixed_value or percentage_value.'
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
def to_xml(root = nil)
|
34
|
-
raise
|
34
|
+
raise InvalidComission if invalid?
|
35
35
|
|
36
36
|
if root.nil?
|
37
37
|
xml = ""
|
@@ -13,8 +13,8 @@ module MyMoip
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def to_json(formatter = MyMoip::Formatter)
|
16
|
-
raise
|
17
|
-
raise
|
16
|
+
raise InvalidCreditCard, 'No credit card provided.' if credit_card.nil?
|
17
|
+
raise InvalidCreditCard if credit_card.invalid?
|
18
18
|
|
19
19
|
json = {
|
20
20
|
Forma: "CartaoCredito",
|
data/lib/mymoip/instruction.rb
CHANGED
@@ -22,10 +22,10 @@ module MyMoip
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def to_xml(root = nil)
|
25
|
-
raise
|
26
|
-
raise
|
25
|
+
raise InvalidPayer if payer.invalid?
|
26
|
+
raise InvalidInstruction if self.invalid?
|
27
27
|
if invalid_commission = commissions.detect { |c| c.invalid? }
|
28
|
-
raise
|
28
|
+
raise InvalidComission, invalid_commission
|
29
29
|
end
|
30
30
|
|
31
31
|
xml = ""
|
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.
|
8
|
+
s.version = "0.5.0"
|
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 = "2013-
|
12
|
+
s.date = "2013-02-19"
|
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 = [
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/mymoip/commission.rb",
|
31
31
|
"lib/mymoip/credit_card.rb",
|
32
32
|
"lib/mymoip/credit_card_payment.rb",
|
33
|
+
"lib/mymoip/exceptions.rb",
|
33
34
|
"lib/mymoip/formatter.rb",
|
34
35
|
"lib/mymoip/instruction.rb",
|
35
36
|
"lib/mymoip/json_parser.rb",
|
data/test/test_commission.rb
CHANGED
@@ -90,7 +90,7 @@ class TestCommission < Test::Unit::TestCase
|
|
90
90
|
def test_cannot_give_gross_amount_without_fixed_or_percentage_value_set
|
91
91
|
instruction = stub(gross_amount: 200)
|
92
92
|
subject = Fixture.commission(fixed_value: nil, percentage_value: nil)
|
93
|
-
assert_raise
|
93
|
+
assert_raise MyMoip::InvalidComission do
|
94
94
|
subject.gross_amount(instruction)
|
95
95
|
end
|
96
96
|
end
|
@@ -114,7 +114,7 @@ XML
|
|
114
114
|
def test_xml_method_raises_exception_when_called_with_invalid_params
|
115
115
|
subject = Fixture.commission
|
116
116
|
subject.stubs(:invalid?).returns(true)
|
117
|
-
assert_raise
|
117
|
+
assert_raise MyMoip::InvalidComission do
|
118
118
|
subject.to_xml
|
119
119
|
end
|
120
120
|
end
|
@@ -91,7 +91,7 @@ class TestCreditCardPayment < Test::Unit::TestCase
|
|
91
91
|
|
92
92
|
def test_to_json_method_raises_an_exception_when_called_without_a_credit_card
|
93
93
|
subject = MyMoip::CreditCardPayment.new(nil)
|
94
|
-
assert_raise
|
94
|
+
assert_raise MyMoip::InvalidCreditCard do
|
95
95
|
subject.to_json
|
96
96
|
end
|
97
97
|
end
|
@@ -107,7 +107,7 @@ class TestCreditCardPayment < Test::Unit::TestCase
|
|
107
107
|
def test_to_json_method_raises_an_exception_when_called_with_a_invalid_credit_card
|
108
108
|
subject = MyMoip::CreditCardPayment.new(Fixture.credit_card)
|
109
109
|
MyMoip::CreditCard.any_instance.stubs(:invalid?).returns(true)
|
110
|
-
assert_raise
|
110
|
+
assert_raise MyMoip::InvalidCreditCard do
|
111
111
|
subject.to_json
|
112
112
|
end
|
113
113
|
end
|
data/test/test_instruction.rb
CHANGED
@@ -90,7 +90,7 @@ XML
|
|
90
90
|
invalid_commission = Fixture.commission
|
91
91
|
invalid_commission.stubs(:invalid?).returns(true)
|
92
92
|
subject = Fixture.instruction(commissions: [Fixture.commission, invalid_commission])
|
93
|
-
assert_raise
|
93
|
+
assert_raise MyMoip::InvalidComission do
|
94
94
|
subject.to_xml
|
95
95
|
end
|
96
96
|
end
|
@@ -98,7 +98,7 @@ XML
|
|
98
98
|
def test_to_xml_method_raises_exception_when_called_with_invalid_payer
|
99
99
|
subject = Fixture.instruction
|
100
100
|
MyMoip::Payer.any_instance.stubs(:invalid?).returns(true)
|
101
|
-
assert_raise
|
101
|
+
assert_raise MyMoip::InvalidPayer do
|
102
102
|
subject.to_xml
|
103
103
|
end
|
104
104
|
end
|
@@ -106,7 +106,7 @@ XML
|
|
106
106
|
def test_to_xml_method_dont_raises_exception_when_called_with_valid_payer
|
107
107
|
subject = Fixture.instruction
|
108
108
|
MyMoip::Payer.any_instance.stubs(:invalid?).returns(false)
|
109
|
-
assert_nothing_raised
|
109
|
+
assert_nothing_raised MyMoip::InvalidPayer do
|
110
110
|
subject.to_xml
|
111
111
|
end
|
112
112
|
end
|
@@ -114,7 +114,7 @@ XML
|
|
114
114
|
def test_to_xml_method_raises_exception_when_called_with_invalid_params
|
115
115
|
subject = Fixture.instruction
|
116
116
|
MyMoip::Instruction.any_instance.stubs(:invalid?).returns(true)
|
117
|
-
assert_raise
|
117
|
+
assert_raise MyMoip::InvalidInstruction do
|
118
118
|
subject.to_xml
|
119
119
|
end
|
120
120
|
end
|
@@ -122,7 +122,7 @@ XML
|
|
122
122
|
def test_to_xml_method_dont_raises_exception_when_called_with_valid_params
|
123
123
|
subject = Fixture.instruction
|
124
124
|
MyMoip::Instruction.any_instance.stubs(:invalid?).returns(false)
|
125
|
-
assert_nothing_raised
|
125
|
+
assert_nothing_raised MyMoip::InvalidInstruction do
|
126
126
|
subject.to_xml
|
127
127
|
end
|
128
128
|
end
|
data/test/test_mymoip.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'helper'
|
3
3
|
|
4
4
|
class TestPaymentRequest < Test::Unit::TestCase
|
5
|
-
|
6
5
|
def test_http_method_as_get
|
7
6
|
assert_equal :get, MyMoip::PaymentRequest::HTTP_METHOD
|
8
7
|
end
|
@@ -94,5 +93,4 @@ class TestPaymentRequest < Test::Unit::TestCase
|
|
94
93
|
payment_request = MyMoip::PaymentRequest.new("your_own_id")
|
95
94
|
assert_nil payment_request.code
|
96
95
|
end
|
97
|
-
|
98
96
|
end
|
data/test/test_request.rb
CHANGED
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.
|
4
|
+
version: 0.5.0
|
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: 2013-
|
12
|
+
date: 2013-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/mymoip/commission.rb
|
193
193
|
- lib/mymoip/credit_card.rb
|
194
194
|
- lib/mymoip/credit_card_payment.rb
|
195
|
+
- lib/mymoip/exceptions.rb
|
195
196
|
- lib/mymoip/formatter.rb
|
196
197
|
- lib/mymoip/instruction.rb
|
197
198
|
- lib/mymoip/json_parser.rb
|
@@ -231,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
232
|
version: '0'
|
232
233
|
segments:
|
233
234
|
- 0
|
234
|
-
hash:
|
235
|
+
hash: -2331743994126201520
|
235
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
237
|
none: false
|
237
238
|
requirements:
|