paymill_ruby 2.0.0 → 2.0.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +16 -9
- data/lib/paymill/models/base.rb +3 -3
- data/lib/paymill/models/checksum.rb +6 -1
- data/lib/paymill/version.rb +1 -1
- data/spec/paymill/models/checksum_spec.rb +39 -0
- data/spec/paymill/models/refund_spec.rb +8 -0
- 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: 77d34134bdbbec75492b51f0d0a40b55e3a2b5ca
|
4
|
+
data.tar.gz: 7c410e7c84db042c9029fc24ea3ab14a050a7cad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da8161a22fa858ebf64515458d9faa34cd1d3fb4dcda8f1fd9286c8aa2e93a707b711c84f50303f71f753e8abde35ab96d40527c69c7d29533f7ffa725d200d8
|
7
|
+
data.tar.gz: f555ea37bea2028b6f7e786335787d8e8ebf13fa8385a21f8fe2eb13069d276615164b29a814002cd90e331c1898a3a6fc0a32ee720a7fe594b10dc60b588797
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
### v2.0.1
|
2
|
+
* allow creating [Checksum](https://github.com/paymill/paymill-ruby/blob/master/lib/paymill/models/checksum.rb#L19) with the parameters __shipping_amount__, __handling_amount__ and __client_id__
|
3
|
+
* fix [issue #23](https://github.com/paymill/paymill-ruby/issues/23) Checksum with Client
|
4
|
+
* fix serialisation for arrays [PR #24](https://github.com/paymill/paymill-ruby/pull/24), thanks to [@morgoth](https://github.com/morgoth)
|
5
|
+
|
1
6
|
### v2.0.0
|
2
7
|
* add [PR #21](https://github.com/paymill/paymill-ruby/pull/21) Do not try to cast every value of JSON to integer, thanks to [@morgoth](https://github.com/morgoth)
|
3
8
|
|
data/README.md
CHANGED
@@ -205,12 +205,19 @@ Checksum.create( checksum_type: 'paypal', amount: 9700, currency: 'EUR', descrip
|
|
205
205
|
Contributing
|
206
206
|
============
|
207
207
|
|
208
|
-
1.
|
209
|
-
2.
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
208
|
+
1. [Fork it](https://github.com/paymill/paymill-ruby/fork)
|
209
|
+
2. Create feature branch
|
210
|
+
- `git checkout -b my-new-feature`
|
211
|
+
3. Setup the project
|
212
|
+
- `bundle install`
|
213
|
+
4. Setup PAYMILL's keys in your environment:
|
214
|
+
- private test key `export PAYMILL_API_TEST_PRIVATE_KEY="<YOUR_TEST_KEY>"`
|
215
|
+
- public test key `export PAYMILL_API_TEST_PUBLIC_KEY="<YOUR_TEST_KEY>"`
|
216
|
+
5. Run the tests
|
217
|
+
- all specs: `rspec .`
|
218
|
+
- single spec: `rspec ./spec/paymill/models/client_spec.rb`
|
219
|
+
6. Commit your changes
|
220
|
+
- `git commit -am 'Add some feature'`
|
221
|
+
7. Push your changes
|
222
|
+
- `git push origin my-new-feature`
|
223
|
+
8. Create new Pull Request
|
data/lib/paymill/models/base.rb
CHANGED
@@ -28,10 +28,10 @@ module Paymill
|
|
28
28
|
json.each_pair do |key, value|
|
29
29
|
case value.class.name
|
30
30
|
when 'Array'
|
31
|
-
|
32
|
-
instance_variable_set( "@#{key}
|
31
|
+
if key.end_with?('s')
|
32
|
+
instance_variable_set( "@#{key}", value.map { |e| (e.is_a? String) ? e : objectize( key[0...-1], e ) } )
|
33
33
|
else
|
34
|
-
instance_variable_set( "@#{key}", value.map { |e| (e.is_a? String) ? e : objectize( key, e ) } )
|
34
|
+
instance_variable_set( "@#{key}s", value.map { |e| (e.is_a? String) ? e : objectize( key, e ) } )
|
35
35
|
end
|
36
36
|
when 'Hash'
|
37
37
|
instance_variable_set( "@#{key}", objectize( key, value ) )
|
@@ -16,7 +16,12 @@ module Paymill
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.allowed_arguments
|
19
|
-
[
|
19
|
+
[
|
20
|
+
:checksum_type, :amount, :currency, :return_url, :cancel_url, :description,
|
21
|
+
:shipping_address, :billing_address, :items, :shipping_amount, :handling_amount, :client_id,
|
22
|
+
:require_reusable_payment, :reusable_payment_description,
|
23
|
+
:fee_amount, :fee_payment, :fee_currency, :app_id
|
24
|
+
]
|
20
25
|
end
|
21
26
|
|
22
27
|
def self.mandatory_arguments
|
data/lib/paymill/version.rb
CHANGED
@@ -33,6 +33,45 @@ module Paymill
|
|
33
33
|
expect( checksum.updated_at ).to be_a Time
|
34
34
|
end
|
35
35
|
|
36
|
+
it 'should create new checksum with minimum parameters and shipping and handling amount', :vcr do
|
37
|
+
checksum = Checksum.create( checksum_type: 'paypal', amount: 4200, currency: 'EUR', description: 'Chuck Testa', return_url: 'https://testa.com', cancel_url: 'https://test.com/cancel', shipping_amount: 300, handling_amount: 500 )
|
38
|
+
|
39
|
+
expect( checksum.action ).to eq 'transaction'
|
40
|
+
expect( checksum.checksum ).to be_a String
|
41
|
+
expect( checksum.data ).to eq 'amount=4200¤cy=EUR&description=Chuck+Testa&return_url=https%3A%2F%2Ftesta.com&cancel_url=https%3A%2F%2Ftest.com%2Fcancel&shipping_amount=300&handling_amount=500'
|
42
|
+
expect( checksum.id ).to be_a String
|
43
|
+
expect( checksum.type ).to eq 'paypal'
|
44
|
+
expect( checksum.app_id ).to be_nil
|
45
|
+
expect( checksum.created_at ).to be_a Time
|
46
|
+
expect( checksum.updated_at ).to be_a Time
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should create new checksum with minimum parameters and client', :vcr do
|
50
|
+
checksum = Checksum.create( checksum_type: 'paypal', amount: 4200, currency: 'EUR', description: 'Chuck Testa', return_url: 'https://testa.com', cancel_url: 'https://test.com/cancel', client_id: 'client_c43af14afac0e4f58f90' )
|
51
|
+
|
52
|
+
expect( checksum.action ).to eq 'transaction'
|
53
|
+
expect( checksum.checksum ).to be_a String
|
54
|
+
expect( checksum.data ).to eq 'amount=4200¤cy=EUR&description=Chuck+Testa&return_url=https%3A%2F%2Ftesta.com&cancel_url=https%3A%2F%2Ftest.com%2Fcancel&client_id=client_c43af14afac0e4f58f90'
|
55
|
+
expect( checksum.id ).to be_a String
|
56
|
+
expect( checksum.type ).to eq 'paypal'
|
57
|
+
expect( checksum.app_id ).to be_nil
|
58
|
+
expect( checksum.created_at ).to be_a Time
|
59
|
+
expect( checksum.updated_at ).to be_a Time
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should create new checksum with minimum parameters and reusable payment', :vcr do
|
63
|
+
checksum = Checksum.create( checksum_type: 'paypal', amount: 4200, currency: 'EUR', description: 'Chuck Testa', return_url: 'https://testa.com', cancel_url: 'https://test.com/cancel', require_reusable_payment: true, reusable_payment_description: 'recurring paypal' )
|
64
|
+
|
65
|
+
expect( checksum.action ).to eq 'transaction'
|
66
|
+
expect( checksum.checksum ).to be_a String
|
67
|
+
expect( checksum.data ).to eq 'amount=4200¤cy=EUR&description=Chuck+Testa&return_url=https%3A%2F%2Ftesta.com&cancel_url=https%3A%2F%2Ftest.com%2Fcancel&require_reusable_payment=true&reusable_payment_description=recurring+paypal'
|
68
|
+
expect( checksum.id ).to be_a String
|
69
|
+
expect( checksum.type ).to eq 'paypal'
|
70
|
+
expect( checksum.app_id ).to be_nil
|
71
|
+
expect( checksum.created_at ).to be_a Time
|
72
|
+
expect( checksum.updated_at ).to be_a Time
|
73
|
+
end
|
74
|
+
|
36
75
|
it 'should create new checksum with minimum parameters and billing address', :vcr do
|
37
76
|
checksum = Checksum.create( checksum_type: 'paypal', amount: 4200, currency: 'EUR', description: 'Chuck Testa', return_url: 'https://testa.com', cancel_url: 'https://test.com/cancel', billing_address: billing_address )
|
38
77
|
|
@@ -57,6 +57,14 @@ module Paymill
|
|
57
57
|
expect( refund.app_id ).to be_nil
|
58
58
|
end
|
59
59
|
|
60
|
+
it 'should return nested refund in transaction object' do
|
61
|
+
transaction = Transaction.create( token: @token, amount: 100, currency: currency )
|
62
|
+
refund = Refund.create( transaction, amount: 100, description: 'Refunded By Ruby' )
|
63
|
+
transaction_with_refund = Transaction.find( transaction.id )
|
64
|
+
|
65
|
+
expect( transaction_with_refund.refunds.first.id ).to eq refund.id
|
66
|
+
end
|
67
|
+
|
60
68
|
it 'should throw ArgumentError when no amount given', :vcr do
|
61
69
|
expect{ Refund.create( Transaction.create( token: @token, amount: 290, currency: currency ) ) }.to raise_error ArgumentError
|
62
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paymill_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vassil Nikolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|