recurly 2.18.23 → 2.18.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd2a6275f99c0018d36fbaa9e825dc17b559ea85e7de03e0c939b36110e5f3a9
4
- data.tar.gz: a73a5a0fdc4a711e78441be22b9f3a4f5244b60214d8b9a3ec8a0f0121268d7c
3
+ metadata.gz: 80f20612581de184e9289de7932e7801799978847a9ee3c464dfd8283c99a6f2
4
+ data.tar.gz: 7f8a60c7be6db9467b434d9c78d7b1aae344313d9af88b3868c9436815ed011f
5
5
  SHA512:
6
- metadata.gz: edc527fa06b7b42d791c54b6be18625ceb2004b2e7d0f55adc092f83d0ea5a9acd4ae22953be7304007996b134f6492e828b6e41d4426e4a8c3613f7205ac18b
7
- data.tar.gz: 344b0d5627a8876373297f23d9648002a37f1897d3be6b6c8feac5021e6b07af9426f929bcf885e5ccd709d8173e53fb9d5604ed45c8b74ee0f7e284eacea8d4
6
+ metadata.gz: ed179b0bb225b7ed545d70788a488d0f1b1518ddaef440a1aed8048490c67cdfd63bd87594a65a9d596dedef54355c5c909468e9bd3b5e11f33277bf55c3d0cf
7
+ data.tar.gz: 15e08b97f21699ce9c005495e81be7bffd842dafbabbd58e0b68be80d8176d168d84c853e092f5956c7662d5513da2ea1007d269f46f84ee89ac36ea566b48e1
data/README.md CHANGED
@@ -14,7 +14,7 @@ Recurly is packaged as a Ruby gem. We recommend you install it with
14
14
  [Bundler](http://gembundler.com/) by adding the following line to your Gemfile:
15
15
 
16
16
  ``` ruby
17
- gem 'recurly', '~> 2.18.23'
17
+ gem 'recurly', '~> 2.18.26'
18
18
  ```
19
19
 
20
20
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
@@ -11,6 +11,7 @@ module Recurly
11
11
  define_attribute_methods %w(
12
12
  past_due
13
13
  balance_in_cents
14
+ processing_prepayment_balance_in_cents
14
15
  )
15
16
 
16
17
  # This object does not represent a model on the server side
@@ -4,6 +4,8 @@ module Recurly
4
4
  belongs_to :plan
5
5
  # @return [[Tier], []]
6
6
  has_many :tiers, class_name: :Tier, readonly: false
7
+ # @return [[PercentageTier], []]
8
+ has_many :percentage_tiers, class_name: :CurrencyPercentageTier, readonly: false
7
9
 
8
10
  define_attribute_methods %w(
9
11
  add_on_code
@@ -24,6 +26,7 @@ module Recurly
24
26
  created_at
25
27
  updated_at
26
28
  tier_type
29
+ usage_timeframe
27
30
  external_sku
28
31
  avalara_service_type
29
32
  avalara_transaction_type
@@ -35,6 +38,8 @@ module Recurly
35
38
  attrs = super
36
39
  if tiers.any?(&:changed?)
37
40
  attrs['tiers'] = tiers.select(&:changed?)
41
+ elsif percentage_tiers.any?(&:changed?)
42
+ attrs['percentage_tiers'] = percentage_tiers.select(&:changed?)
38
43
  end
39
44
  attrs
40
45
  end
@@ -51,6 +51,7 @@ module Recurly
51
51
  tax_region
52
52
  tax_rate
53
53
  tax_exempt
54
+ tax_inclusive
54
55
  tax_code
55
56
  tax_details
56
57
  tax_types
@@ -61,6 +62,7 @@ module Recurly
61
62
  surcharge_in_cents
62
63
  avalara_transaction_type
63
64
  avalara_service_type
65
+ refundable_total_in_cents
64
66
  )
65
67
  alias to_param uuid
66
68
 
@@ -11,6 +11,7 @@ module Recurly
11
11
  SEPA_ATTRIBUTES = %w(iban last_two).freeze
12
12
  BACS_ATTRIBUTES = %w(account_number sort_code type).freeze
13
13
  BECS_ATTRIBUTES = %w(account_number bsb_code type).freeze
14
+ VENMO_ATTRIBUTES = %w(username).freeze
14
15
 
15
16
  # @return [Account]
16
17
  belongs_to :account
@@ -47,7 +48,7 @@ module Recurly
47
48
  backup_payment_method
48
49
  cc_bin_country
49
50
  online_banking_payment_type
50
- ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES | SEPA_ATTRIBUTES | BACS_ATTRIBUTES | BECS_ATTRIBUTES
51
+ ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES | SEPA_ATTRIBUTES | BACS_ATTRIBUTES | BECS_ATTRIBUTES | VENMO_ATTRIBUTES
51
52
 
52
53
  # Verify an account's stored billing info
53
54
  #
@@ -58,32 +59,48 @@ module Recurly
58
59
  Transaction.from_response API.post("#{path}/verify", attrs.empty? ? nil : Verify.to_xml(attrs))
59
60
  end
60
61
 
62
+ def self.to_xml(attrs)
63
+ billing_info = new attrs
64
+ billing_info.to_xml
65
+ end
66
+
67
+ # Verify a credit card CVV
68
+ #
69
+ # @param [Hash] verification_value is the credit card CVV
70
+ # @return [BillingInfo]
71
+ def verify_cvv(attrs = {})
72
+ BillingInfo.from_response API.post("#{path}/verify_cvv", attrs.empty? ? nil : self.class.to_xml(attrs))
73
+ end
74
+
61
75
  # @return [String]
62
76
  def inspect
63
77
  attributes = self.class.attribute_names
64
78
  case type
65
79
  when 'credit_card'
66
- attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
80
+ attributes -= (AMAZON_ATTRIBUTES + PAYPAL_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
67
81
  attributes |= CREDIT_CARD_ATTRIBUTES
68
82
  when 'paypal'
69
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
83
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
70
84
  when 'amazon'
71
- attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
85
+ attributes -= (CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES + PAYPAL_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
72
86
  when 'bank_account'
73
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
87
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
74
88
  attributes |= BANK_ACCOUNT_ATTRIBUTES
75
89
  when 'roku'
76
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
90
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
77
91
  attributes |= ROKU_ATTRIBUTES
78
92
  when 'sepa'
79
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
93
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
80
94
  attributes |= SEPA_ATTRIBUTES
81
95
  when 'bacs'
82
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BECS_ATTRIBUTES)
96
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BECS_ATTRIBUTES + VENMO_ATTRIBUTES)
83
97
  attributes |= BACS_ATTRIBUTES
84
98
  when 'becs'
85
- attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES)
99
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + VENMO_ATTRIBUTES)
86
100
  attributes |= BECS_ATTRIBUTES
101
+ when 'venmo'
102
+ attributes -= (CREDIT_CARD_ATTRIBUTES + PAYPAL_ATTRIBUTES + AMAZON_ATTRIBUTES + BANK_ACCOUNT_ATTRIBUTES + ROKU_ATTRIBUTES + SEPA_ATTRIBUTES + BACS_ATTRIBUTES + BECS_ATTRIBUTES)
103
+ attributes |= VENMO_ATTRIBUTES
87
104
  end
88
105
  super attributes
89
106
  end
@@ -0,0 +1,17 @@
1
+ module Recurly
2
+ class CurrencyPercentageTier < Resource
3
+
4
+ belongs_to :add_on
5
+ has_many :tiers, class_name: :PercentageTier, readonly: false
6
+
7
+ define_attribute_methods %w(
8
+ currency
9
+ )
10
+
11
+ def xml_keys
12
+ attributes.keys
13
+ end
14
+
15
+ embedded! true
16
+ end
17
+ end
@@ -116,6 +116,7 @@ module Recurly
116
116
  tax_details
117
117
  billing_info_uuid
118
118
  dunning_campaign_id
119
+ refundable_total_in_cents
119
120
  )
120
121
  alias to_param invoice_number_with_prefix
121
122
 
@@ -0,0 +1,17 @@
1
+ module Recurly
2
+ class PercentageTier < Resource
3
+
4
+ belongs_to :currency_percentage_tier
5
+
6
+ define_attribute_methods %w(
7
+ ending_amount_in_cents
8
+ usage_percentage
9
+ )
10
+
11
+ def xml_keys
12
+ attributes.keys
13
+ end
14
+
15
+ embedded! true
16
+ end
17
+ end
data/lib/recurly/plan.rb CHANGED
@@ -4,6 +4,9 @@ module Recurly
4
4
  # @return [Pager<AddOn>, []]
5
5
  has_many :add_ons
6
6
 
7
+ # @return [[PlanRampInterval], nil]
8
+ has_many :ramp_intervals, class_name: :PlanRampInterval
9
+
7
10
  define_attribute_methods %w(
8
11
  plan_code
9
12
  name
@@ -21,6 +24,8 @@ module Recurly
21
24
  unit_amount_in_cents
22
25
  plan_interval_length
23
26
  plan_interval_unit
27
+ pricing_model
28
+ ramp_intervals
24
29
  trial_interval_length
25
30
  trial_interval_unit
26
31
  total_billing_cycles
@@ -0,0 +1,10 @@
1
+ module Recurly
2
+ class PlanRampInterval < Resource
3
+ belongs_to :plan
4
+
5
+ define_attribute_methods %w(
6
+ starting_billing_cycle
7
+ unit_amount_in_cents
8
+ )
9
+ end
10
+ end
@@ -754,8 +754,8 @@ module Recurly
754
754
  if association
755
755
  value = fetch_associated(key, value)
756
756
  # FIXME: More explicit; less magic.
757
- elsif value && key.end_with?('_in_cents') && !respond_to?(:currency)
758
- value = Money.new(value, self, key) unless value.is_a?(Money)
757
+ elsif add_money_tag?(key, value)
758
+ value = Money.new(value, self, key)
759
759
  end
760
760
 
761
761
  attributes[key] = value
@@ -1118,5 +1118,15 @@ module Recurly
1118
1118
  def xml_keys
1119
1119
  changed_attributes.keys.sort
1120
1120
  end
1121
+
1122
+ def add_money_tag?(key, value)
1123
+ value &&
1124
+ key.end_with?('_in_cents') &&
1125
+ !respond_to?(:currency) &&
1126
+ !value.is_a?(Money) &&
1127
+ !is_a?(PercentageTier)&&
1128
+ !is_a?(SubAddOnPercentageTier)&&
1129
+ !is_a?(SubscriptionRampInterval)
1130
+ end
1121
1131
  end
1122
1132
  end
@@ -0,0 +1,17 @@
1
+ module Recurly
2
+ class SubAddOnPercentageTier < Resource
3
+
4
+ belongs_to :subscription_add_on
5
+
6
+ define_attribute_methods %w(
7
+ ending_amount_in_cents
8
+ usage_percentage
9
+ )
10
+
11
+ def xml_keys
12
+ attributes.keys
13
+ end
14
+
15
+ embedded! true
16
+ end
17
+ end
@@ -23,6 +23,9 @@ module Recurly
23
23
  # @return [[CustomField], []]
24
24
  has_many :custom_fields, class_name: :CustomField, readonly: false
25
25
 
26
+ # @return [[SubscriptionRampInterval], nil]
27
+ has_many :ramp_intervals, class_name: :SubscriptionRampInterval
28
+
26
29
  # @return [Account]
27
30
  belongs_to :account
28
31
 
@@ -63,6 +66,7 @@ module Recurly
63
66
  subscription_add_ons
64
67
  coupon_code
65
68
  coupon_codes
69
+ ramp_intervals
66
70
  total_billing_cycles
67
71
  remaining_billing_cycles
68
72
  net_terms
@@ -72,6 +76,7 @@ module Recurly
72
76
  tax_type
73
77
  tax_region
74
78
  tax_rate
79
+ tax_inclusive
75
80
  bulk
76
81
  bank_account_authorized_at
77
82
  terms_and_conditions
@@ -9,6 +9,9 @@ module Recurly
9
9
  # @return [[Tier], []]
10
10
  has_many :tiers, class_name: :Tier, readonly: false
11
11
 
12
+ # @return [[PercentageTier], []]
13
+ has_many :percentage_tiers, class_name: :SubAddOnPercentageTier, readonly: false
14
+
12
15
  define_attribute_methods %w(
13
16
  add_on_code
14
17
  quantity
@@ -16,6 +19,7 @@ module Recurly
16
19
  add_on_type
17
20
  usage_type
18
21
  usage_percentage
22
+ usage_timeframe
19
23
  add_on_source
20
24
  )
21
25
 
@@ -36,6 +40,7 @@ module Recurly
36
40
  self.add_on_source = add_on.add_on_source
37
41
  end
38
42
  self.tiers = add_on.tiers if add_on.tiers.any?
43
+ self.percentage_tiers = add_on.percentage_tiers if add_on.percentage_tiers.any?
39
44
  when Hash
40
45
  self.attributes = add_on
41
46
  when String, Symbol
@@ -0,0 +1,10 @@
1
+ module Recurly
2
+ class SubscriptionRampInterval < Resource
3
+ belongs_to :subscription
4
+
5
+ define_attribute_methods %w(
6
+ starting_billing_cycle
7
+ unit_amount_in_cents
8
+ )
9
+ end
10
+ end
@@ -1,6 +1,6 @@
1
1
  module Recurly
2
2
  module Version
3
- VERSION = "2.18.23"
3
+ VERSION = "2.18.26"
4
4
 
5
5
  class << self
6
6
  def inspect
@@ -8,7 +8,7 @@ module Recurly
8
8
  end
9
9
 
10
10
  def add_element name, value = nil
11
- root.add_child(node = ::Nokogiri::XML::Element.new(name, root))
11
+ root.add_child(node = ::Nokogiri::XML::Element.new(name, root.document))
12
12
  node << value if value
13
13
  node
14
14
  end
data/lib/recurly.rb CHANGED
@@ -27,11 +27,13 @@ module Recurly
27
27
  require 'recurly/measured_unit'
28
28
  require 'recurly/note'
29
29
  require 'recurly/plan'
30
+ require 'recurly/plan_ramp_interval'
30
31
  require 'recurly/redemption'
31
32
  require 'recurly/shipping_fee'
32
33
  require 'recurly/shipping_method'
33
34
  require 'recurly/subscription'
34
35
  require 'recurly/subscription_add_on'
36
+ require 'recurly/subscription_ramp_interval'
35
37
  require 'recurly/transaction'
36
38
  require 'recurly/usage'
37
39
  require 'recurly/version'
@@ -45,6 +47,9 @@ module Recurly
45
47
  require 'recurly/dunning_campaign'
46
48
  require 'recurly/dunning_cycle'
47
49
  require 'recurly/invoice_template'
50
+ require 'recurly/percentage_tier'
51
+ require 'recurly/currency_percentage_tier'
52
+ require 'recurly/sub_add_on_percentage_tier'
48
53
 
49
54
  @subdomain = nil
50
55
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recurly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.18.23
4
+ version: 2.18.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-03 00:00:00.000000000 Z
11
+ date: 2022-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -139,6 +139,7 @@ files:
139
139
  - lib/recurly/billing_info.rb
140
140
  - lib/recurly/coupon.rb
141
141
  - lib/recurly/credit_payment.rb
142
+ - lib/recurly/currency_percentage_tier.rb
142
143
  - lib/recurly/custom_field.rb
143
144
  - lib/recurly/delivery.rb
144
145
  - lib/recurly/dunning_campaign.rb
@@ -155,7 +156,9 @@ files:
155
156
  - lib/recurly/measured_unit.rb
156
157
  - lib/recurly/money.rb
157
158
  - lib/recurly/note.rb
159
+ - lib/recurly/percentage_tier.rb
158
160
  - lib/recurly/plan.rb
161
+ - lib/recurly/plan_ramp_interval.rb
159
162
  - lib/recurly/purchase.rb
160
163
  - lib/recurly/redemption.rb
161
164
  - lib/recurly/resource.rb
@@ -165,9 +168,11 @@ files:
165
168
  - lib/recurly/shipping_address.rb
166
169
  - lib/recurly/shipping_fee.rb
167
170
  - lib/recurly/shipping_method.rb
171
+ - lib/recurly/sub_add_on_percentage_tier.rb
168
172
  - lib/recurly/subscription.rb
169
173
  - lib/recurly/subscription/add_ons.rb
170
174
  - lib/recurly/subscription_add_on.rb
175
+ - lib/recurly/subscription_ramp_interval.rb
171
176
  - lib/recurly/tax_detail.rb
172
177
  - lib/recurly/tax_type.rb
173
178
  - lib/recurly/tier.rb