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 +4 -4
- data/README.md +1 -1
- data/lib/recurly/account_balance.rb +1 -0
- data/lib/recurly/add_on.rb +5 -0
- data/lib/recurly/adjustment.rb +2 -0
- data/lib/recurly/billing_info.rb +26 -9
- data/lib/recurly/currency_percentage_tier.rb +17 -0
- data/lib/recurly/invoice.rb +1 -0
- data/lib/recurly/percentage_tier.rb +17 -0
- data/lib/recurly/plan.rb +5 -0
- data/lib/recurly/plan_ramp_interval.rb +10 -0
- data/lib/recurly/resource.rb +12 -2
- data/lib/recurly/sub_add_on_percentage_tier.rb +17 -0
- data/lib/recurly/subscription.rb +5 -0
- data/lib/recurly/subscription_add_on.rb +5 -0
- data/lib/recurly/subscription_ramp_interval.rb +10 -0
- data/lib/recurly/version.rb +1 -1
- data/lib/recurly/xml/nokogiri.rb +1 -1
- data/lib/recurly.rb +5 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80f20612581de184e9289de7932e7801799978847a9ee3c464dfd8283c99a6f2
|
4
|
+
data.tar.gz: 7f8a60c7be6db9467b434d9c78d7b1aae344313d9af88b3868c9436815ed011f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
17
|
+
gem 'recurly', '~> 2.18.26'
|
18
18
|
```
|
19
19
|
|
20
20
|
Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
|
data/lib/recurly/add_on.rb
CHANGED
@@ -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
|
data/lib/recurly/adjustment.rb
CHANGED
@@ -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
|
|
data/lib/recurly/billing_info.rb
CHANGED
@@ -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
|
data/lib/recurly/invoice.rb
CHANGED
@@ -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
|
data/lib/recurly/resource.rb
CHANGED
@@ -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
|
758
|
-
value = Money.new(value, self, key)
|
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
|
data/lib/recurly/subscription.rb
CHANGED
@@ -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
|
data/lib/recurly/version.rb
CHANGED
data/lib/recurly/xml/nokogiri.rb
CHANGED
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.
|
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-
|
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
|