paymill_ruby 1.0.2 → 2.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e883a63ce492c9a8875d002cf089970a8368a9eb
4
- data.tar.gz: c7393c11f67b212890afef61f1320c2a4d4312c5
3
+ metadata.gz: f34701098ef1e12edee39999c74dd828ce7e97d1
4
+ data.tar.gz: 86226113f04964f01e0ea3ea7b596440b5d8ed16
5
5
  SHA512:
6
- metadata.gz: 53000c3a307360159a9b573d4ebdaa94b20bc0e918e4108e086888614595eabede434c2216577a4d4493017b85ab994473f562ccdee6f4318f3ff69db153a84f
7
- data.tar.gz: 412035f597b59608248c5c2787554d7fe4e4ecde3f522467b781f97c2d92ebc4ea2a065e9d8fcef0089ba873ac7fe997f90b7259547ff7d6417001a2e498477e
6
+ metadata.gz: 915418949f32fc65a7a23914574511c05bc59ae569a9f829f836494b2bf30b6e1d06d6fad430d26ce223a074460d4ce0f316b973a7345315a7ac34ff428b9ae9
7
+ data.tar.gz: fc3778b33308d85932a502836dc0b9c757495354cd73960c107a545e5e0ae1a8972559ef52d93511682de4541938c1a0aefaf5fc2d0a3a10f9420224e8e27839
data/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
- v1.0.0
2
- ------
1
+ ### v2.0.0
2
+ * 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
+
4
+ ### v1.0.2
5
+ * fix [issue #6](https://github.com/paymill/paymill-ruby/issues/6) Add new parameter mandate_reference
6
+ * fix [issue #7](https://github.com/paymill/paymill-ruby/issues/7) ActiveSupport 4.1 requirement
7
+ * fix [issue #8](https://github.com/paymill/paymill-ruby/issues/8) No access to iban and bic
8
+ * fix [issue #9](https://github.com/paymill/paymill-ruby/issues/9) Add explanation on how to run the spec
9
+ * Add Checksum, Address and ShoppingCartItem objects for paypal payments.
10
+
11
+ ### v0.0.1 (unreleased)
3
12
 
4
13
  - initial release inspired by [dkd's paymill-ruby](https://github.com/dkd/paymill-ruby) wrapper
data/README.md CHANGED
@@ -3,16 +3,16 @@
3
3
  paymill-ruby
4
4
  ============
5
5
 
6
- Ruby wrapper for PAYMILL API forked by [dkd's paymill-ruby](https://github.com/dkd/paymill-ruby)
6
+ Ruby wrapper for PAYMILL API forked from [dkd's paymill-ruby](https://github.com/dkd/paymill-ruby)
7
7
 
8
8
  [![Build Status](https://travis-ci.org/paymill/paymill-ruby.svg)](https://travis-ci.org/paymill/paymill-ruby) [![Code Climate](https://codeclimate.com/github/paymill/paymill-ruby/badges/gpa.svg)](https://codeclimate.com/github/paymill/paymill-ruby)
9
9
 
10
10
  Getting started
11
11
  ===============
12
12
 
13
- - If you are not familiar with PAYMILL, start with the [documentation](https://www.paymill.com/en-gb/documentation-3/).
13
+ - If you are not familiar with PAYMILL, start with the [documentation](https://developers.paymill.com).
14
14
  - Install the latest release.
15
- - Check the API [reference](https://www.paymill.com/en-gb/documentation-3/reference/api-reference/).
15
+ - Check the API [reference](https://developers.paymill.com/API/).
16
16
  - Check the specification examples.
17
17
  - Take a look at the [change log](./CHANGELOG.md) for recent updates and improvements.
18
18
 
@@ -22,7 +22,7 @@ Installation
22
22
  Add this line to your application's Gemfile:
23
23
 
24
24
  ```ruby
25
- gem 'paymill_ruby', '~> 1.0'
25
+ gem 'paymill_ruby', '~> 2.0', require: 'paymill'
26
26
  ```
27
27
 
28
28
  And then execute:
@@ -31,7 +31,7 @@ And then execute:
31
31
  $ bundle
32
32
  ```
33
33
 
34
- The paymill gem is tested on Ruby 1.9.3, 2.0.0, 2.1.0, 2.1.3 and 2.1.5. It requires ruby version 1.9.3+
34
+ The paymill gem is tested on Ruby 2.0.0, 2.1.x and 2.2.x. It requires ruby version 2.0 and up.
35
35
 
36
36
  Usage
37
37
  =====
@@ -49,7 +49,7 @@ or by reading it from the envirounment variables
49
49
  ```ruby
50
50
  require 'paymill'
51
51
 
52
- Paymill.api_key = ENV['PAYMILL_API_TEST_KEY']
52
+ Paymill.api_key = ENV['PAYMILL_API_TEST_PRIVATE_KEY']
53
53
  ```
54
54
 
55
55
  Clients
@@ -173,6 +173,8 @@ refund = Refund.create( transaction, amount: 100 )
173
173
  Checksum
174
174
  --------
175
175
 
176
+ For transactions that are started client-side, e.g. PayPal checkout, it is required to first create a checksum on your server and then provide that checksum when starting the transaction in the browser. The checksum needs to contain all data required to subsequently create the actual transaction. In the examples below checksum is created with address, Shopping cart item and fee. Of course you can use all variations from this parameters to fit your needs.
177
+
176
178
  #### Creating plain checksum
177
179
 
178
180
  ```ruby
@@ -200,24 +202,15 @@ Checksum.create( checksum_type: 'paypal', amount: 9700, currency: 'EUR', descrip
200
202
  Checksum.create( checksum_type: 'paypal', amount: 9700, currency: 'EUR', description: 'Chuck Testa', return_url: 'https://testa.com', cancel_url: 'https://test.com/cancel', fee_amount: 100, fee_payment: 'pay_3af44644dd6d25c820a8', fee_currency: 'EUR', app_id: '8fh98hfd828ej2e09dk0hf9' )
201
203
  ```
202
204
 
203
- Changelog
204
- =========
205
-
206
- ### 1.0.0
207
- * fix [issue #6](https://github.com/paymill/paymill-ruby/issues/6) Add new parameter mandate_reference
208
- * fix [issue #7](https://github.com/paymill/paymill-ruby/issues/7) ActiveSupport 4.1 requirement
209
- * fix [issue #8](https://github.com/paymill/paymill-ruby/issues/8) No access to iban and bic
210
- * fix [issue #9](https://github.com/paymill/paymill-ruby/issues/9) Add explanation on how to run the spec
211
- * Add Checksum, Address and ShoppingCartItem objects for paypal payments.
212
-
213
205
  Contributing
214
206
  ============
215
207
 
216
208
  1. Fork it ( https://github.com/paymill/paymill-ruby/fork )
217
209
  2. Create your feature branch (`git checkout -b my-new-feature`)
218
210
  3. Setup the project (`bundle install`)
219
- 4. Setup PAYMILL's test key in your environment (`export PAYMILL_API_TEST_KEY="<YOUR_TEST_KEY>"`)
220
- 5. Run all the tests (`rspec .)` or a subset from them (`rspec ./spec/paymill/models/client_spec.rb`)
221
- 6. Commit your changes (`git commit -am 'Add some feature'`)
222
- 7. Push to the branch (`git push origin my-new-feature`)
223
- 8. Create a new Pull Request
211
+ 4. Setup PAYMILL's private test key in your environment (`export PAYMILL_API_TEST_PRIVATE_KEY="<YOUR_TEST_KEY>"`)
212
+ 5. Setup PAYMILL's public test key in your environment (`export PAYMILL_API_TEST_PUBLIC_KEY="<YOUR_TEST_KEY>"`)
213
+ 6. Run all the tests (`rspec .)` or a subset from them (`rspec ./spec/paymill/models/client_spec.rb`)
214
+ 7. Commit your changes (`git commit -am 'Add some feature'`)
215
+ 8. Push to the branch (`git push origin my-new-feature`)
216
+ 9. Create a new Pull Request
@@ -36,7 +36,7 @@ module Paymill
36
36
  when 'Hash'
37
37
  instance_variable_set( "@#{key}", objectize( key, value ) )
38
38
  else
39
- instance_variable_set( "@#{key}", (Integer( value ) rescue value) )
39
+ instance_variable_set( "@#{key}", value )
40
40
  end
41
41
  end
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module Paymill
2
- VERSION = "1.0.2"
2
+ VERSION = "2.0.0"
3
3
  end
data/paymill.gemspec CHANGED
@@ -4,18 +4,21 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'paymill/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "paymill_ruby"
8
- spec.version = Paymill::VERSION
9
- spec.authors = ["Vassil Nikolov"]
10
- spec.email = ["vassil.nikolov@qaiware.com"]
11
- spec.summary = %q{The official ruby wrapper for PAYMILL's API.}
12
- spec.homepage = "https://github.com/paymill/paymill-ruby"
13
- spec.license = "MIT"
7
+ spec.name = "paymill_ruby"
8
+ spec.version = Paymill::VERSION
9
+ spec.authors = ["Vassil Nikolov"]
10
+ spec.email = ["vassil.nikolov@qaiware.com"]
11
+ spec.summary = %q{The official ruby wrapper for PAYMILL's API.}
12
+ spec.homepage = "https://github.com/paymill/paymill-ruby"
13
+ spec.license = "MIT"
14
+
15
+ spec.require_paths = ["lib"]
16
+ spec.required_ruby_version = '>= 2.0'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0") - ['.gitignore', '.travis.yml', '.rspec']
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
14
21
 
15
- spec.files = `git ls-files -z`.split("\x0") - ['.gitignore', '.travis.yml', '.rspec']
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
19
22
 
20
23
  spec.add_development_dependency "bundler", "~> 1.7"
21
24
  spec.add_development_dependency "activesupport", "~> 4.2"
@@ -9,114 +9,13 @@ module Paymill
9
9
  it 'should throw AuthenticationError when API_KEY is not set', :vcr do
10
10
  Paymill.api_key = nil
11
11
  expect{ Client.find( 'fake_id' ) }.to raise_error AuthenticationError
12
- Paymill.api_key = ENV['PAYMILL_API_TEST_KEY']
12
+ Paymill.api_key = ENV['PAYMILL_API_TEST_PRIVATE_KEY']
13
13
  end
14
14
 
15
15
  it 'should throw NotFoundError when unexisting client id given', :vcr do
16
16
  expect{ Client.find( 'fake_id' ) }.to raise_error PaymillError
17
17
  end
18
18
 
19
- it 'should find a Client object when valid client id is given', :vcr do
20
- client = Client.find( 'client_a6dcf82f63c3a5627454' )
21
-
22
- expect( client ).to be_a Client
23
- expect( client.id ).to eq 'client_a6dcf82f63c3a5627454'
24
- expect( client.email ).to eq 'john.rambo@qaiware.com'
25
- expect( client.description ).to eq 'Boom, boom, shake the room'
26
- expect( client.created_at ).to be_a Time
27
- expect( client.updated_at ).to be_a Time
28
- expect( client.app_id ).to be_nil
29
-
30
- expect( client.payments ).not_to be_nil
31
- expect( client.payments.first ).to be_a Payment
32
-
33
- expect( client.payments.first.id ).to eq 'pay_e3d67dfaf30a237308d42bf2'
34
- expect( client.payments.first.type ).to eq 'creditcard'
35
- expect( client.payments.first.client ).to eq 'client_a6dcf82f63c3a5627454'
36
- expect( client.payments.first.card_type ).to eq 'visa'
37
- expect( client.payments.first.country ).to be_nil
38
- expect( client.payments.first.expire_month ).to eq 12
39
- expect( client.payments.first.expire_year ).to eq 2015
40
- expect( client.payments.first.card_holder ).to be_empty
41
- expect( client.payments.first.last4 ).to eq 1111
42
- expect( client.payments.first.created_at ).to be_a Time
43
- expect( client.payments.first.updated_at ).to be_a Time
44
- expect( client.payments.first.app_id ).to be_nil
45
- expect( client.payments.first.is_recurring ).to be true
46
- expect( client.payments.first.is_usable_for_preauthorization ).to be true
47
-
48
-
49
- expect( client.subscriptions ).not_to be_nil
50
-
51
- expect( client.subscriptions.first ).to be_a Subscription
52
- expect( client.subscriptions.first.id ).to eq 'sub_386b863839a6c9f6c584'
53
- expect( client.subscriptions.first.offer.id ).to eq 'offer_5c74768d4d854c9df2a1'
54
- expect( client.subscriptions.first.offer.name ).to eq 'test1'
55
- expect( client.subscriptions.first.offer.amount ).to be 2000
56
- expect( client.subscriptions.first.offer.currency ).to eq 'EUR'
57
- expect( client.subscriptions.first.offer.interval ).to eq '1 WEEK'
58
- expect( client.subscriptions.first.offer.trial_period_days ).to be_nil
59
- expect( client.subscriptions.first.offer.created_at ).to be_a Time
60
- expect( client.subscriptions.first.offer.updated_at ).to be_a Time
61
- expect( client.subscriptions.first.offer.subscription_count.active ).to be 1
62
- expect( client.subscriptions.first.offer.subscription_count.inactive ).to be 0
63
- expect( client.subscriptions.first.offer.app_id ).to be_nil
64
- expect( client.subscriptions.first.livemode ).to be false
65
- expect( client.subscriptions.first.amount ).to be 2000
66
- expect( client.subscriptions.first.temp_amount ).to be_nil
67
- expect( client.subscriptions.first.currency ).to eq 'USD'
68
- expect( client.subscriptions.first.name ).to eq 'test2'
69
- expect( client.subscriptions.first.interval ).to eq '2 MONTH'
70
- expect( client.subscriptions.first.trial_start ).to be_nil
71
- expect( client.subscriptions.first.trial_end ).to be_nil
72
- expect( client.subscriptions.first.period_of_validity ).to be_nil
73
- expect( client.subscriptions.first.end_of_period ).to be_nil
74
- expect( client.subscriptions.first.next_capture_at ).to be_a Time
75
- expect( client.subscriptions.first.created_at ).to be_a Time
76
- expect( client.subscriptions.first.updated_at ).to be_a Time
77
- expect( client.subscriptions.first.canceled_at ).to be_nil
78
- expect( client.subscriptions.first.payment ).to eq 'pay_f71c32615742beac11bf7b7c'
79
- expect( client.subscriptions.first.app_id ).to be_nil
80
- expect( client.subscriptions.first.is_canceled ).to be false
81
- expect( client.subscriptions.first.is_deleted ).to be false
82
- expect( client.subscriptions.first.status ).to eq 'active'
83
- expect( client.subscriptions.first.client ).to eq 'client_a6dcf82f63c3a5627454'
84
-
85
-
86
- expect( client.subscriptions.last ).to be_a Subscription
87
- expect( client.subscriptions.last.id ).to eq 'sub_386b863839a6c9f6c584'
88
- expect( client.subscriptions.last.offer.id ).to eq 'offer_5c74768d4d854c9df2a1'
89
- expect( client.subscriptions.last.offer.name ).to eq 'test1'
90
- expect( client.subscriptions.last.offer.amount ).to be 2000
91
- expect( client.subscriptions.last.offer.currency ).to eq 'EUR'
92
- expect( client.subscriptions.last.offer.interval ).to eq '1 WEEK'
93
- expect( client.subscriptions.last.offer.trial_period_days ).to be_nil
94
- expect( client.subscriptions.last.offer.created_at ).to be_a Time
95
- expect( client.subscriptions.last.offer.updated_at ).to be_a Time
96
- expect( client.subscriptions.last.offer.subscription_count.active ).to be 1
97
- expect( client.subscriptions.last.offer.subscription_count.inactive ).to be 0
98
- expect( client.subscriptions.last.offer.app_id ).to be_nil
99
- expect( client.subscriptions.last.livemode ).to be false
100
- expect( client.subscriptions.last.amount ).to be 2000
101
- expect( client.subscriptions.last.temp_amount ).to be_nil
102
- expect( client.subscriptions.last.currency ).to eq 'USD'
103
- expect( client.subscriptions.last.name ).to eq 'test2'
104
- expect( client.subscriptions.last.interval ).to eq '2 MONTH'
105
- expect( client.subscriptions.last.trial_start ).to be_nil
106
- expect( client.subscriptions.last.trial_end ).to be_nil
107
- expect( client.subscriptions.last.period_of_validity ).to be_nil
108
- expect( client.subscriptions.last.end_of_period ).to be_nil
109
- expect( client.subscriptions.last.next_capture_at ).to be_a Time
110
- expect( client.subscriptions.last.created_at ).to be_a Time
111
- expect( client.subscriptions.last.updated_at ).to be_a Time
112
- expect( client.subscriptions.last.canceled_at ).to be_nil
113
- expect( client.subscriptions.last.payment ).to eq 'pay_f71c32615742beac11bf7b7c'
114
- expect( client.subscriptions.last.app_id ).to be_nil
115
- expect( client.subscriptions.last.is_canceled ).to be false
116
- expect( client.subscriptions.last.is_deleted ).to be false
117
- expect( client.subscriptions.last.status ).to eq 'active'
118
- expect( client.subscriptions.last.client ).to eq 'client_a6dcf82f63c3a5627454'
119
- end
120
19
  end
121
20
 
122
21
  context '::create' do
@@ -273,7 +172,7 @@ module Paymill
273
172
  expect( clients ).to respond_to :data_count
274
173
  end
275
174
 
276
- it 'should get all clients with sorting and filters', :vcr do
175
+ xit 'should get all clients with sorting and filters', :vcr do
277
176
  # 2015-07-08 00:43:14 to 2015-07-14 23:23:14
278
177
  clients = Client.all( order: [:email_asc], filters: [created_at: "1436316194-1436916194"] )
279
178
 
@@ -282,7 +181,7 @@ module Paymill
282
181
  expect( clients.size ).to be 20
283
182
  end
284
183
 
285
- it 'should get all clients with filters', :vcr do
184
+ xit 'should get all clients with filters', :vcr do
286
185
  clients = Client.all( filters: [email: 'john.rambo@qaiware.com', description: 'Boom, boom, shake the room'] )
287
186
 
288
187
  expect( clients ).to be_a Array
@@ -290,7 +189,7 @@ module Paymill
290
189
  expect( clients.size ).to be 20
291
190
  end
292
191
 
293
- it 'should get all clients with order and count', :vcr do
192
+ xit 'should get all clients with order and count', :vcr do
294
193
  clients = Client.all( order: [:email, :created_at_desc], count: 30 )
295
194
 
296
195
  expect( clients ).to be_a Array
@@ -298,7 +197,7 @@ module Paymill
298
197
  expect( clients.size ).to be 30
299
198
  end
300
199
 
301
- it 'should get all clients with order, count and offset', :vcr do
200
+ xit 'should get all clients with order, count and offset', :vcr do
302
201
  clients = Client.all( order: [:email, :created_at_desc], count: 30, offset: 10 )
303
202
 
304
203
  expect( clients ).to be_a Array
@@ -5,35 +5,13 @@ module Paymill
5
5
 
6
6
  offer_id = nil
7
7
 
8
- context '::find' do
9
- it 'should find a Offer object when valid offer id is given', :vcr do
10
- offer = Offer.find( 'offer_9bba76a5e8bca1407230' )
11
-
12
- expect( offer.id ).to eq 'offer_9bba76a5e8bca1407230'
13
- expect( offer.name ).to eq 'Chuck Testa'
14
- expect( offer.amount ).to be 10000
15
- expect( offer.currency ).to eq 'EUR'
16
- expect( offer.interval ).to eq '1 MONTH'
17
- expect( offer.trial_period_days ).to be 0
18
- expect( offer.created_at ).to be_a Time
19
- expect( offer.updated_at ).to be_a Time
20
- expect( offer.subscription_count.active ).to be 0
21
- expect( offer.subscription_count.inactive ).to be 0
22
- expect( offer.app_id ).to be_nil
23
- end
24
-
25
- it 'should throw NotFoundError when unexisting offer id given', :vcr do
26
- expect{ Offer.find( 'fake_id' ) }.to raise_error PaymillError
27
- end
28
- end
29
-
30
8
  context '::create' do
31
9
  it 'should create new offer without trial period in days', :vcr do
32
10
  offer = Offer.create( amount: 4200, currency: 'EUR', interval: '1 MONTH', name: 'Superabo' )
33
11
 
34
12
  expect( offer.id ).to be_a String
35
13
  expect( offer.name ).to eq 'Superabo'
36
- expect( offer.amount ).to be 4200
14
+ expect( offer.amount ).to eq 4200.to_s # bug in API
37
15
  expect( offer.currency ).to eq 'EUR'
38
16
  expect( offer.interval ).to eq '1 MONTH'
39
17
  expect( offer.trial_period_days ).to be 0
@@ -50,7 +28,7 @@ module Paymill
50
28
 
51
29
  expect( offer.id ).to be_a String
52
30
  expect( offer.name ).to eq 'sabo'
53
- expect( offer.amount ).to eq 4200
31
+ expect( offer.amount ).to eq 4200.to_s # bug in API
54
32
  expect( offer.currency ).to eq 'EUR'
55
33
  expect( offer.interval ).to eq '1 MONTH'
56
34
  expect( offer.trial_period_days ).to be 30
@@ -74,6 +52,28 @@ module Paymill
74
52
  end
75
53
  end
76
54
 
55
+ context '::find' do
56
+ it 'should find a Offer object when valid offer id is given', :vcr do
57
+ offer = Offer.find( offer_id )
58
+
59
+ expect( offer.id ).to eq offer_id
60
+ expect( offer.name ).to eq 'sabo'
61
+ expect( offer.amount ).to be 4200
62
+ expect( offer.currency ).to eq 'EUR'
63
+ expect( offer.interval ).to eq '1 MONTH'
64
+ expect( offer.trial_period_days ).to be 30
65
+ expect( offer.created_at ).to be_a Time
66
+ expect( offer.updated_at ).to be_a Time
67
+ expect( offer.subscription_count.active ).to be 0
68
+ expect( offer.subscription_count.inactive ).to be 0
69
+ expect( offer.app_id ).to be_nil
70
+ end
71
+
72
+ it 'should throw NotFoundError when unexisting offer id given', :vcr do
73
+ expect{ Offer.find( 'fake_id' ) }.to raise_error PaymillError
74
+ end
75
+ end
76
+
77
77
  context '::update' do
78
78
  it "should update offer's name", :vcr do
79
79
  offer = Offer.find( offer_id )
@@ -85,7 +85,7 @@ module Paymill
85
85
 
86
86
  expect( offer.id ).to eq offer_id
87
87
  expect( offer.name ).to eq 'Superabo'
88
- expect( offer.amount ).to eq 4200
88
+ expect( offer.amount ).to eq 4200.to_s # bug in API
89
89
  expect( offer.currency ).to eq 'EUR'
90
90
  expect( offer.interval ).to eq '1 MONTH'
91
91
  expect( offer.trial_period_days ).to be 30
@@ -104,7 +104,7 @@ module Paymill
104
104
 
105
105
  expect( offer.id ).to eq offer_id
106
106
  expect( offer.name ).to eq 'Superabo'
107
- expect( offer.amount ).to eq 900
107
+ expect( offer.amount ).to eq 900.to_s # bug in API
108
108
  expect( offer.currency ).to eq 'USD'
109
109
  expect( offer.interval ).to eq '1 MONTH'
110
110
  expect( offer.trial_period_days ).to be 30
@@ -122,7 +122,7 @@ module Paymill
122
122
 
123
123
  expect( offer.id ).to eq offer_id
124
124
  expect( offer.name ).to eq 'Superabo'
125
- expect( offer.amount ).to eq 1000
125
+ expect( offer.amount ).to eq 1000.to_s # bug in API
126
126
  expect( offer.currency ).to eq 'USD'
127
127
  expect( offer.interval ).to eq '1 MONTH'
128
128
  expect( offer.trial_period_days ).to be 30
@@ -7,43 +7,14 @@ module Paymill
7
7
 
8
8
  let( :client ) { Client.create( email: 'john.rambo@qaiware.com') }
9
9
 
10
- context '::find' do
11
- it 'should find a payment by given valid id', :vcr do
12
- payment = Payment.find( 'pay_cc87bc3445daf8da2329b108' )
13
-
14
- expect( payment ).to be_a Payment
15
-
16
- expect( payment.type ).to eq 'creditcard'
17
- expect( payment.client ).to be_nil
18
- expect( payment.card_type ). to eq 'visa'
19
-
20
- expect( payment.country ).to eq 'DE'
21
- expect( payment.expire_month ).to eq 12
22
- expect( payment.expire_year ).to eq 2020
23
- expect( payment.card_holder ).to eq 'joe johnson'
24
- expect( payment.last4 ).to eq 1111
25
- expect( payment.is_recurring ).to be true
26
- expect( payment.is_usable_for_preauthorization ).to be true
27
-
28
- expect( payment.id ).to eq 'pay_cc87bc3445daf8da2329b108'
29
- expect( payment.created_at ).to be_a Time
30
- expect( payment.updated_at ).to be_a Time
31
- expect( payment.app_id ).to be_nil
32
- end
33
-
34
- it 'should throw NotFoundError when unexisting payment id given', :vcr do
35
- expect{ Payment.find( 'fake_id' ) }.to raise_error PaymillError
36
- end
37
- end
38
-
39
10
  context '::create' do
40
11
  context 'creditcard' do
41
12
  before( :each ) do
42
- uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=Max%20Mustermann&presentation.amount3D=3201&presentation.currency3D=EUR")
13
+ uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=#{ENV['PAYMILL_API_TEST_PUBLIC_KEY']}&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=Max%20Mustermann&presentation.amount3D=3201&presentation.currency3D=EUR")
43
14
  https = Net::HTTP.new(uri.host, uri.port)
44
15
  https.use_ssl = true
45
16
  request = Net::HTTP::Get.new(uri.request_uri)
46
- request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
17
+ request.basic_auth( ENV['PAYMILL_API_TEST_PRIVATE_KEY'], "" )
47
18
  response = https.request(request)
48
19
  @token = response.body.match('tok_[a-z|0-9]+')[0]
49
20
  end
@@ -59,10 +30,10 @@ module Paymill
59
30
  expect( payment.card_type ). to eq 'visa'
60
31
 
61
32
  expect( payment.country ).to be_nil
62
- expect( payment.expire_month ).to be 12
63
- expect( payment.expire_year ).to be 2015
33
+ expect( payment.expire_month ).to eq '12'
34
+ expect( payment.expire_year ).to eq '2015'
64
35
  expect( payment.card_holder ).to eq 'Max Mustermann'
65
- expect( payment.last4 ).to eq 1111
36
+ expect( payment.last4 ).to eq '1111'
66
37
  expect( payment.is_recurring ).to be true
67
38
  expect( payment.is_usable_for_preauthorization ).to be true
68
39
 
@@ -83,10 +54,10 @@ module Paymill
83
54
  expect( payment.card_type ).to eq 'visa'
84
55
 
85
56
  expect( payment.country ).to be_nil
86
- expect( payment.expire_month ).to eq 12
87
- expect( payment.expire_year ).to eq 2015
57
+ expect( payment.expire_month ).to eq '12'
58
+ expect( payment.expire_year ).to eq '2015'
88
59
  expect( payment.card_holder ).to eq 'Max Mustermann'
89
- expect( payment.last4 ).to eq 1111
60
+ expect( payment.last4 ).to eq '1111'
90
61
  expect( payment.is_recurring ).to be true
91
62
  expect( payment.is_usable_for_preauthorization ).to be true
92
63
 
@@ -119,13 +90,42 @@ module Paymill
119
90
  end
120
91
  end
121
92
 
93
+ context '::find' do
94
+ it 'should find a payment by given valid id', :vcr do
95
+ payment = Payment.find( payment_id )
96
+
97
+ expect( payment ).to be_a Payment
98
+
99
+ expect( payment.type ).to eq 'creditcard'
100
+ expect( payment.client ).to be_nil
101
+ expect( payment.card_type ). to eq 'visa'
102
+
103
+ expect( payment.country ).to be nil
104
+ expect( payment.expire_month ).to eq '12'
105
+ expect( payment.expire_year ).to eq '2015'
106
+ expect( payment.card_holder ).to eq 'Max Mustermann'
107
+ expect( payment.last4 ).to eq '1111'
108
+ expect( payment.is_recurring ).to be true
109
+ expect( payment.is_usable_for_preauthorization ).to be true
110
+
111
+ expect( payment.id ).to eq payment_id
112
+ expect( payment.created_at ).to be_a Time
113
+ expect( payment.updated_at ).to be_a Time
114
+ expect( payment.app_id ).to be_nil
115
+ end
116
+
117
+ it 'should throw NotFoundError when unexisting payment id given', :vcr do
118
+ expect{ Payment.find( 'fake_id' ) }.to raise_error PaymillError
119
+ end
120
+ end
121
+
122
122
  context 'debit' do
123
123
  before( :each ) do
124
124
  uri = URI.parse("https://test-token.paymill.de/?transaction.mode=CONNECTOR_TEST&channel.id=14704210606b41cbb45f66819085cb8d&response.url=https://test-tds.paymill.de/end.php?parentUrl=http%253A%252F%252Fhtmlpreview.github.io%252F%253Fhttps%253A%252F%252Fgithub.com%252Fpaymill%252Fpaymill-payment-form%252Fblob%252Fmaster%252Fpaymill_payment_sepa.html&&jsonPFunction=window.paymill.transport.paymillCallback298646523&account.iban=DE12500105170648489890&account.bic=BENEDEPPYYY&account.country=DE&account.holder=John+Rambo")
125
125
  https = Net::HTTP.new(uri.host, uri.port)
126
126
  https.use_ssl = true
127
127
  request = Net::HTTP::Get.new(uri.request_uri)
128
- request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
128
+ request.basic_auth( ENV['PAYMILL_API_TEST_PRIVATE_KEY'], "" )
129
129
  response = https.request(request)
130
130
  @token = response.body.match('uniqueId":"\w*')[0].split('":"').last
131
131
  end
@@ -11,11 +11,11 @@ module Paymill
11
11
 
12
12
  context '::create' do
13
13
  before( :each ) do
14
- uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
14
+ uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=#{ENV['PAYMILL_API_TEST_PUBLIC_KEY']}&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
15
15
  https = Net::HTTP.new(uri.host, uri.port)
16
16
  https.use_ssl = true
17
17
  request = Net::HTTP::Get.new(uri.request_uri)
18
- request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
18
+ request.basic_auth( ENV['PAYMILL_API_TEST_PRIVATE_KEY'], "" )
19
19
  response = https.request(request)
20
20
  @token = response.body.match('tok_[a-z|0-9]+')[0]
21
21
  @payment = Payment.create( token: @token, client: client.id )
@@ -28,7 +28,7 @@ module Paymill
28
28
  expect( preauthorization ).to be_a Preauthorization
29
29
 
30
30
  expect( preauthorization.id ).to be_a String
31
- expect( preauthorization.amount ).to be amount
31
+ expect( preauthorization.amount ).to eq amount.to_s # bug in API
32
32
  expect( preauthorization.currency ).to eq currency
33
33
  expect( preauthorization.description ).to be_nil
34
34
  expect( preauthorization.status ).to eq 'closed'
@@ -43,10 +43,10 @@ module Paymill
43
43
  expect( preauthorization.payment.card_type ). to eq 'visa'
44
44
 
45
45
  expect( preauthorization.payment.country ).to be_nil
46
- expect( preauthorization.payment.expire_month ).to eq 12
47
- expect( preauthorization.payment.expire_year ).to eq 2015
46
+ expect( preauthorization.payment.expire_month ).to eq '12'
47
+ expect( preauthorization.payment.expire_year ).to eq '2015'
48
48
  expect( preauthorization.payment.card_holder ).to eq 'John Rambo'
49
- expect( preauthorization.payment.last4 ).to eq 1111
49
+ expect( preauthorization.payment.last4 ).to eq '1111'
50
50
  expect( preauthorization.payment.is_recurring ).to be true
51
51
  expect( preauthorization.payment.is_usable_for_preauthorization ).to be true
52
52
 
@@ -67,7 +67,7 @@ module Paymill
67
67
  expect( preauthorization ).to be_a Preauthorization
68
68
 
69
69
  expect( preauthorization.id ).to be_a String
70
- expect( preauthorization.amount ).to be amount
70
+ expect( preauthorization.amount ).to eq amount.to_s # bug in API
71
71
  expect( preauthorization.currency ).to eq currency
72
72
  expect( preauthorization.description ).to be_nil
73
73
  expect( preauthorization.status ).to eq 'closed'
@@ -83,10 +83,10 @@ module Paymill
83
83
  expect( preauthorization.payment.card_type ). to eq 'visa'
84
84
 
85
85
  expect( preauthorization.payment.country ).to be_nil
86
- expect( preauthorization.payment.expire_month ).to eq 12
87
- expect( preauthorization.payment.expire_year ).to eq 2015
86
+ expect( preauthorization.payment.expire_month ).to eq '12'
87
+ expect( preauthorization.payment.expire_year ).to eq '2015'
88
88
  expect( preauthorization.payment.card_holder ).to eq 'John Rambo'
89
- expect( preauthorization.payment.last4 ).to eq 1111
89
+ expect( preauthorization.payment.last4 ).to eq '1111'
90
90
  expect( preauthorization.payment.is_recurring ).to be true
91
91
  expect( preauthorization.payment.is_usable_for_preauthorization ).to be true
92
92
 
@@ -109,7 +109,7 @@ module Paymill
109
109
  expect( preauthorization ).to be_a Preauthorization
110
110
 
111
111
  expect( preauthorization.id ).to be_a String
112
- expect( preauthorization.amount ).to be amount
112
+ expect( preauthorization.amount ).to eq amount.to_s # bug in API
113
113
  expect( preauthorization.currency ).to eq currency
114
114
  expect( preauthorization.description ).to eq 'The Italian Stallion'
115
115
  expect( preauthorization.status ).to eq 'closed'
@@ -125,10 +125,10 @@ module Paymill
125
125
  expect( preauthorization.payment.card_type ). to eq 'visa'
126
126
 
127
127
  expect( preauthorization.payment.country ).to be_nil
128
- expect( preauthorization.payment.expire_month ).to eq 12
129
- expect( preauthorization.payment.expire_year ).to eq 2015
128
+ expect( preauthorization.payment.expire_month ).to eq '12'
129
+ expect( preauthorization.payment.expire_year ).to eq '2015'
130
130
  expect( preauthorization.payment.card_holder ).to eq 'John Rambo'
131
- expect( preauthorization.payment.last4 ).to eq 1111
131
+ expect( preauthorization.payment.last4 ).to eq '1111'
132
132
  expect( preauthorization.payment.is_recurring ).to be true
133
133
  expect( preauthorization.payment.is_usable_for_preauthorization ).to be true
134
134
 
@@ -9,11 +9,11 @@ module Paymill
9
9
 
10
10
  context '::create' do
11
11
  before( :each ) do
12
- uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
12
+ uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=#{ENV['PAYMILL_API_TEST_PUBLIC_KEY']}&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
13
13
  https = Net::HTTP.new(uri.host, uri.port)
14
14
  https.use_ssl = true
15
15
  request = Net::HTTP::Get.new(uri.request_uri)
16
- request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
16
+ request.basic_auth( ENV['PAYMILL_API_TEST_PRIVATE_KEY'], "" )
17
17
  response = https.request(request)
18
18
  @token = response.body.match('tok_[a-z|0-9]+')[0]
19
19
  end
@@ -77,7 +77,7 @@ module Paymill
77
77
  expect( refund.livemode ).to be false
78
78
  expect( refund.created_at ).to be_a Time
79
79
  expect( refund.updated_at ).to be_a Time
80
- expect( refund.response_code ).to be 20000
80
+ expect( refund.response_code ).to eq '20000'
81
81
  expect( refund.transaction ).not_to be_nil
82
82
  expect( refund.app_id ).to be_nil
83
83
  end
@@ -13,11 +13,11 @@ module Paymill
13
13
 
14
14
  context '::create' do
15
15
  before( :each ) do
16
- uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
16
+ uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=#{ENV['PAYMILL_API_TEST_PUBLIC_KEY']}&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
17
17
  https = Net::HTTP.new(uri.host, uri.port)
18
18
  https.use_ssl = true
19
19
  request = Net::HTTP::Get.new(uri.request_uri)
20
- request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
20
+ request.basic_auth( ENV['PAYMILL_API_TEST_PRIVATE_KEY'], "" )
21
21
  response = https.request(request)
22
22
  @token = response.body.match('tok_[a-z|0-9]+')[0]
23
23
  @payment = Payment.create( token: @token, client: client.id )
@@ -67,7 +67,7 @@ module Paymill
67
67
  expect( subscription ).to be_a Subscription
68
68
 
69
69
  expect( subscription.id ).to be_a String
70
- expect( subscription.offer.amount ).to be amount
70
+ expect( subscription.offer.amount ).to eq amount.to_s # bug in API
71
71
  expect( subscription.offer.currency ).to eq currency
72
72
  expect( subscription.offer.interval ).to eq interval
73
73
  expect( subscription.livemode ).to be false
@@ -99,7 +99,7 @@ module Paymill
99
99
  expect( subscription ).to be_a Subscription
100
100
 
101
101
  expect( subscription.id ).to be_a String
102
- expect( subscription.offer.amount ).to be amount
102
+ expect( subscription.offer.amount ).to eq amount.to_s # bug in API
103
103
  expect( subscription.offer.currency ).to eq currency
104
104
  expect( subscription.offer.interval ).to eq interval
105
105
  expect( subscription.livemode ).to be false
@@ -165,7 +165,7 @@ module Paymill
165
165
 
166
166
  expect( subscription.id ).to be_a String
167
167
  expect( subscription.mandate_reference ).to eq 'Terminator'
168
- expect( subscription.offer.amount ).to be amount
168
+ expect( subscription.offer.amount ).to eq amount.to_s # bug in API
169
169
  expect( subscription.offer.currency ).to eq currency
170
170
  expect( subscription.offer.interval ).to eq interval
171
171
  expect( subscription.offer.name ).to eq 'Basic Stallion'
@@ -238,11 +238,11 @@ module Paymill
238
238
 
239
239
  context '::update' do
240
240
  before( :each ) do
241
- uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
241
+ uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=#{ENV['PAYMILL_API_TEST_PUBLIC_KEY']}&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
242
242
  https = Net::HTTP.new(uri.host, uri.port)
243
243
  https.use_ssl = true
244
244
  request = Net::HTTP::Get.new(uri.request_uri)
245
- request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
245
+ request.basic_auth( ENV['PAYMILL_API_TEST_PRIVATE_KEY'], "" )
246
246
  response = https.request(request)
247
247
  @token = response.body.match('tok_[a-z|0-9]+')[0]
248
248
  @payment = Payment.create( token: @token, client: client.id )
@@ -363,12 +363,12 @@ module Paymill
363
363
  subscription.update_offer_without_changes( new_offer )
364
364
 
365
365
  expect( subscription.id ).to be_a String
366
- expect( subscription.offer.amount ).to be new_offer.amount
366
+ expect( subscription.offer.amount.to_s ).to eq new_offer.amount # bug in API
367
367
  expect( subscription.offer.currency ).to eq new_offer.currency
368
368
  expect( subscription.offer.interval ).to eq new_offer.interval
369
369
  expect( subscription.offer.name ).to eq new_offer.name
370
370
  expect( subscription.livemode ).to be false
371
- expect( subscription.amount ).to be new_offer.amount
371
+ expect( subscription.amount.to_s ).to eq new_offer.amount # bug in API
372
372
  expect( subscription.temp_amount ).to be_nil
373
373
  expect( subscription.currency ).to eq new_offer.currency
374
374
  expect( subscription.name ).to eq new_offer.name
@@ -396,12 +396,12 @@ module Paymill
396
396
  subscription.update_offer_with_refund( new_offer )
397
397
 
398
398
  expect( subscription.id ).to be_a String
399
- expect( subscription.offer.amount ).to be new_offer.amount
399
+ expect( subscription.offer.amount.to_s ).to eq new_offer.amount # bug in API
400
400
  expect( subscription.offer.currency ).to eq new_offer.currency
401
401
  expect( subscription.offer.interval ).to eq new_offer.interval
402
402
  expect( subscription.offer.name ).to eq new_offer.name
403
403
  expect( subscription.livemode ).to be false
404
- expect( subscription.amount ).to be new_offer.amount
404
+ expect( subscription.amount.to_s ).to eq new_offer.amount # bug in API
405
405
  expect( subscription.temp_amount ).to be_nil
406
406
  expect( subscription.currency ).to eq new_offer.currency
407
407
  expect( subscription.name ).to eq new_offer.name
@@ -429,12 +429,12 @@ module Paymill
429
429
  subscription.update_offer_with_refund_and_capture_date( new_offer )
430
430
 
431
431
  expect( subscription.id ).to be_a String
432
- expect( subscription.offer.amount ).to be new_offer.amount
432
+ expect( subscription.offer.amount.to_s ).to eq new_offer.amount # bug in API
433
433
  expect( subscription.offer.currency ).to eq new_offer.currency
434
434
  expect( subscription.offer.interval ).to eq new_offer.interval
435
435
  expect( subscription.offer.name ).to eq new_offer.name
436
436
  expect( subscription.livemode ).to be false
437
- expect( subscription.amount ).to be new_offer.amount
437
+ expect( subscription.amount.to_s ).to eq new_offer.amount # bug in API
438
438
  expect( subscription.temp_amount ).to be_nil
439
439
  expect( subscription.currency ).to eq new_offer.currency
440
440
  expect( subscription.name ).to eq new_offer.name
@@ -535,11 +535,11 @@ module Paymill
535
535
 
536
536
  context '::delete' do
537
537
  before( :each ) do
538
- uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
538
+ uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=#{ENV['PAYMILL_API_TEST_PUBLIC_KEY']}&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
539
539
  https = Net::HTTP.new(uri.host, uri.port)
540
540
  https.use_ssl = true
541
541
  request = Net::HTTP::Get.new(uri.request_uri)
542
- request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
542
+ request.basic_auth( ENV['PAYMILL_API_TEST_PRIVATE_KEY'], "" )
543
543
  response = https.request(request)
544
544
  @token = response.body.match('tok_[a-z|0-9]+')[0]
545
545
  @payment = Payment.create( token: @token, client: client.id )
@@ -550,12 +550,12 @@ module Paymill
550
550
  subscription = Subscription.create( payment: @payment, offer: offer, name: 'To Delete' ).cancel
551
551
 
552
552
  expect( subscription.id ).to be_a String
553
- expect( subscription.offer.amount ).to be offer.amount
553
+ expect( subscription.offer.amount.to_s ).to eq offer.amount # bug in API
554
554
  expect( subscription.offer.currency ).to eq offer.currency
555
555
  expect( subscription.offer.interval ).to eq offer.interval
556
556
  expect( subscription.offer.name ).to eq offer.name
557
557
  expect( subscription.livemode ).to be false
558
- expect( subscription.amount ).to be offer.amount
558
+ expect( subscription.amount.to_s ).to eq offer.amount # bug in API
559
559
  expect( subscription.temp_amount ).to be_nil
560
560
  expect( subscription.currency ).to eq offer.currency
561
561
  expect( subscription.name ).to eq 'To Delete'
@@ -578,12 +578,12 @@ module Paymill
578
578
  subscription = Subscription.create( payment: @payment, offer: offer, name: 'To Delete' ).remove
579
579
 
580
580
  expect( subscription.id ).to be_a String
581
- expect( subscription.offer.amount ).to be offer.amount
581
+ expect( subscription.offer.amount.to_s ).to eq offer.amount # bug in API
582
582
  expect( subscription.offer.currency ).to eq offer.currency
583
583
  expect( subscription.offer.interval ).to eq offer.interval
584
584
  expect( subscription.offer.name ).to eq offer.name
585
585
  expect( subscription.livemode ).to be false
586
- expect( subscription.amount ).to be offer.amount
586
+ expect( subscription.amount.to_s ).to eq offer.amount # bug in API
587
587
  expect( subscription.temp_amount ).to be_nil
588
588
  expect( subscription.currency ).to eq offer.currency
589
589
  expect( subscription.name ).to eq 'To Delete'
@@ -11,11 +11,11 @@ module Paymill
11
11
 
12
12
  context '::create' do
13
13
  before( :each ) do
14
- uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=941569045353c8ac2a5689deb88871bb&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
14
+ uri = URI.parse("https://test-token.paymill.com?transaction.mode=CONNECTOR_TEST&channel.id=#{ENV['PAYMILL_API_TEST_PUBLIC_KEY']}&jsonPFunction=paymilljstests&account.number=4111111111111111&account.expiry.month=12&account.expiry.year=2015&account.verification=123&account.holder=John%20Rambo&presentation.amount3D=3201&presentation.currency3D=EUR")
15
15
  https = Net::HTTP.new(uri.host, uri.port)
16
16
  https.use_ssl = true
17
17
  request = Net::HTTP::Get.new(uri.request_uri)
18
- request.basic_auth( ENV['PAYMILL_API_TEST_KEY'], "" )
18
+ request.basic_auth( ENV['PAYMILL_API_TEST_PRIVATE_KEY'], "" )
19
19
  response = https.request(request)
20
20
  @token = response.body.match('tok_[a-z|0-9]+')[0]
21
21
  @payment = Payment.create( token: @token, client: client.id )
data/spec/spec_helper.rb CHANGED
@@ -5,7 +5,7 @@ require 'active_support/all'
5
5
  require 'uri'
6
6
 
7
7
  # initialize the library by getting paymill's api key from the envirounent variables
8
- Paymill.api_key = ENV['PAYMILL_API_TEST_KEY']
8
+ Paymill.api_key = ENV['PAYMILL_API_TEST_PRIVATE_KEY']
9
9
 
10
10
  # VCR basic configuration
11
11
  VCR.configure do |config|
@@ -14,7 +14,8 @@ VCR.configure do |config|
14
14
  config.hook_into :webmock
15
15
  config.default_cassette_options = { record: :new_episodes, re_record_interval: 1.week.to_i }
16
16
  config.configure_rspec_metadata!
17
- config.filter_sensitive_data( '<PAYMILL_API_TEST_KEY>' ) { ENV['PAYMILL_API_TEST_KEY'] }
17
+ config.filter_sensitive_data( '<PAYMILL_API_TEST_PRIVATE_KEY>' ) { ENV['PAYMILL_API_TEST_PRIVATE_KEY'] }
18
+ config.filter_sensitive_data( '<PAYMILL_API_TEST_PUBLIC_KEY>' ) { ENV['PAYMILL_API_TEST_PUBLIC_KEY'] }
18
19
  end
19
20
 
20
21
  # RSpec configuration
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paymill_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.0.0
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-08-20 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '4.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: vcr
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '2.9'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.9'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.20'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.20'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0.10'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.10'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: guard-rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '4.3'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '4.3'
125
125
  description:
@@ -237,17 +237,17 @@ require_paths:
237
237
  - lib
238
238
  required_ruby_version: !ruby/object:Gem::Requirement
239
239
  requirements:
240
- - - '>='
240
+ - - ">="
241
241
  - !ruby/object:Gem::Version
242
- version: '0'
242
+ version: '2.0'
243
243
  required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  requirements:
245
- - - '>='
245
+ - - ">="
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  requirements: []
249
249
  rubyforge_project:
250
- rubygems_version: 2.0.14
250
+ rubygems_version: 2.4.6
251
251
  signing_key:
252
252
  specification_version: 4
253
253
  summary: The official ruby wrapper for PAYMILL's API.