paymill_ruby 2.0.1 → 2.0.2

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: 77d34134bdbbec75492b51f0d0a40b55e3a2b5ca
4
- data.tar.gz: 7c410e7c84db042c9029fc24ea3ab14a050a7cad
3
+ metadata.gz: a9527e1a8cd00aa060bb7beb6b0add7de0a05f74
4
+ data.tar.gz: 0ebe9916b684c9c5f7b366ecd101011f615fea79
5
5
  SHA512:
6
- metadata.gz: da8161a22fa858ebf64515458d9faa34cd1d3fb4dcda8f1fd9286c8aa2e93a707b711c84f50303f71f753e8abde35ab96d40527c69c7d29533f7ffa725d200d8
7
- data.tar.gz: f555ea37bea2028b6f7e786335787d8e8ebf13fa8385a21f8fe2eb13069d276615164b29a814002cd90e331c1898a3a6fc0a32ee720a7fe594b10dc60b588797
6
+ metadata.gz: 4720162b2c476c36945fb4762f006ad997801d00b020329c0a105fba81540bf9ee1799d4218e8bfeaebdd8a769bfd43005a330c310c25f3d0f0996850d6c1a19
7
+ data.tar.gz: db24cedf764c1a83faa8b4c5531b396c4e24aaf22e46b51e0436bc61ee5b9e68c1995b192d2c9c9732673afe706b4865da38de84a5f0bc47c7beb6332bf2f312
@@ -1,3 +1,7 @@
1
+ ### v2.0.2
2
+ * fix change class name of ShoppingCartItem to Item
3
+ * fix [PR #25](https://github.com/paymill/paymill-ruby/pull/25) update of subscription, thanks to [@Archetylator](https://github.com/Archetylator)
4
+
1
5
  ### v2.0.1
2
6
  * 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
7
  * fix [issue #23](https://github.com/paymill/paymill-ruby/issues/23) Checksum with Client
@@ -20,7 +20,7 @@ module Paymill
20
20
  autoload :PaymentMethod, 'paymill/models/payment_method'
21
21
  autoload :Preauthorization, 'paymill/models/preauthorization'
22
22
  autoload :Refund, 'paymill/models/refund.rb'
23
- autoload :ShoppingCartItem, 'paymill/models/shopping_cart_item'
23
+ autoload :Item, 'paymill/models/item'
24
24
  autoload :Subscription, 'paymill/models/subscription'
25
25
  autoload :SubscriptionCount, 'paymill/models/subscription_count'
26
26
  autoload :Transaction, 'paymill/models/transaction'
@@ -2,7 +2,7 @@ module Paymill
2
2
  class Checksum
3
3
  extend Restful::Create
4
4
 
5
- attr_reader :id, :created_at, :updated_at, :app_id, :action, :checksum, :data, :type, :shipping_address
5
+ attr_reader :id, :created_at, :updated_at, :app_id, :action, :checksum, :data, :type, :items, :shipping_address
6
6
 
7
7
  def initialize( json )
8
8
  deserialize( json )
@@ -1,10 +1,10 @@
1
1
  module Paymill
2
- class ShoppingCartItem
2
+ class Item
3
3
  attr_accessor :name, :amount, :quantity, :item_number, :url, :description
4
4
 
5
5
  def initialize( arguments = {} )
6
6
  arguments.each do |key, value|
7
- raise ArgumentError.new( "parameter #{key} is not allowed" ) unless ShoppingCartItem.instance_methods( false ).include? key
7
+ raise ArgumentError.new( "parameter #{key} is not allowed" ) unless Item.instance_methods( false ).include? key
8
8
  instance_variable_set( "@#{key}", ( Integer( value ) rescue value ) )
9
9
  end
10
10
  end
@@ -48,7 +48,7 @@ module Paymill
48
48
  end
49
49
 
50
50
  def update_offer_with_refund_and_capture_date( offer )
51
- update_offer( offer, 1 )
51
+ update_offer( offer, 2 )
52
52
  end
53
53
 
54
54
  def stop_trial_period()
@@ -136,7 +136,7 @@ module Paymill
136
136
  @amount = nil
137
137
  @payment = nil
138
138
  @offer = offer
139
- update( offer_change_type: 1 )
139
+ update( offer_change_type: flag )
140
140
  end
141
141
 
142
142
  end
@@ -3,7 +3,7 @@ module Paymill
3
3
  include Restful::Update
4
4
 
5
5
  attr_accessor :description
6
- attr_reader :amount, :client, :currency, :origin_amount, :status, :livemode, :refunds,
6
+ attr_reader :amount, :client, :currency, :origin_amount, :status, :livemode, :refunds, :items,
7
7
  :response_code, :is_fraud, :short_id, :fees, :invoices, :payment, :preauthorization, :mandate_reference
8
8
 
9
9
  protected
@@ -71,7 +71,7 @@ module Paymill
71
71
  parameters.each do |key, value|
72
72
  if value.is_a? Array
73
73
  value.each.with_index do |e, index|
74
- if e.is_a? ShoppingCartItem
74
+ if e.is_a? Item
75
75
  e.instance_variables.each do |var|
76
76
  attributes["items[#{index}][#{var.to_s[1..-1]}]"] = e.instance_variable_get( var ) unless e.instance_variable_get( var ).to_s.empty?
77
77
  end
@@ -1,3 +1,3 @@
1
1
  module Paymill
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
@@ -9,12 +9,12 @@ module Paymill
9
9
  )
10
10
  }
11
11
  let( :rambo_poster ) {
12
- ShoppingCartItem.new(
12
+ Item.new(
13
13
  name: "Rambo Poster", description: "John J. Rambo", amount: 2200, quantity: 3, item_number: "898-24342-343", url: "http://www.store.com/items/posters/12121-rambo"
14
14
  )
15
15
  }
16
16
  let( :comando_poster ) {
17
- ShoppingCartItem.new(
17
+ Item.new(
18
18
  name: "Comando Poster", description: "John Matrix", amount: 3100, quantity: 1, item_number: "898-24342-341", url: "http://www.store.com/items/posters/12121-comando"
19
19
  )
20
20
  }
@@ -358,10 +358,9 @@ module Paymill
358
358
 
359
359
  it 'should change the offer of a subscription with no refund and unchanged capture date', :vcr do
360
360
  subscription = Subscription.create( payment: @payment, offer: offer )
361
+ subscription_before_update = subscription.dup
361
362
  new_offer = Offer.create( name: 'Foo', amount: 4990, currency: 'EUR', interval: '2 WEEK')
362
-
363
363
  subscription.update_offer_without_changes( new_offer )
364
-
365
364
  expect( subscription.id ).to be_a String
366
365
  expect( subscription.offer.amount.to_s ).to eq new_offer.amount # bug in API
367
366
  expect( subscription.offer.currency ).to eq new_offer.currency
@@ -378,6 +377,7 @@ module Paymill
378
377
  expect( subscription.period_of_validity ).to be_nil
379
378
  expect( subscription.end_of_period ).to be_nil
380
379
  expect( subscription.next_capture_at ).to be_a Time
380
+ expect( subscription.next_capture_at ).to eq subscription_before_update.next_capture_at
381
381
  expect( subscription.created_at ).to be_a Time
382
382
  expect( subscription.updated_at ).to be_a Time
383
383
  expect( subscription.canceled_at ).to be_nil
@@ -391,6 +391,7 @@ module Paymill
391
391
 
392
392
  it 'should change the offer of a subscription with refund and unchanged capture date', :vcr do
393
393
  subscription = Subscription.create( payment: @payment, offer: offer )
394
+ subscription_before_update = subscription.dup
394
395
  new_offer = Offer.create( name: 'Foo', amount: 1990, currency: 'EUR', interval: '2 WEEK')
395
396
 
396
397
  subscription.update_offer_with_refund( new_offer )
@@ -411,6 +412,7 @@ module Paymill
411
412
  expect( subscription.period_of_validity ).to be_nil
412
413
  expect( subscription.end_of_period ).to be_nil
413
414
  expect( subscription.next_capture_at ).to be_a Time
415
+ expect( subscription.next_capture_at ).to eq subscription_before_update.next_capture_at
414
416
  expect( subscription.created_at ).to be_a Time
415
417
  expect( subscription.updated_at ).to be_a Time
416
418
  expect( subscription.canceled_at ).to be_nil
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.1
4
+ version: 2.0.2
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-19 00:00:00.000000000 Z
11
+ date: 2015-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -143,13 +143,13 @@ files:
143
143
  - lib/paymill/models/client.rb
144
144
  - lib/paymill/models/fee.rb
145
145
  - lib/paymill/models/invoice.rb
146
+ - lib/paymill/models/item.rb
146
147
  - lib/paymill/models/merchant.rb
147
148
  - lib/paymill/models/offer.rb
148
149
  - lib/paymill/models/payment.rb
149
150
  - lib/paymill/models/payment_method.rb
150
151
  - lib/paymill/models/preauthorization.rb
151
152
  - lib/paymill/models/refund.rb
152
- - lib/paymill/models/shopping_cart_item.rb
153
153
  - lib/paymill/models/subscription.rb
154
154
  - lib/paymill/models/subscription_count.rb
155
155
  - lib/paymill/models/transaction.rb
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  version: '0'
248
248
  requirements: []
249
249
  rubyforge_project:
250
- rubygems_version: 2.4.6
250
+ rubygems_version: 2.4.5.1
251
251
  signing_key:
252
252
  specification_version: 4
253
253
  summary: The official ruby wrapper for PAYMILL's API.