recurly 2.18.14 → 2.18.19

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: 0aef5f4769bbf0800eb110b5d687c5a942022a371c92c87edb8cc4bf23bc7503
4
- data.tar.gz: 0d45adbbc2f0250aebcefa96b5f43b7f4d314443f648c84caa030b7327b5d074
3
+ metadata.gz: ac56d6049b53eb2c114df18605fe133df332a509acf3af2cfccffa5214b8f3e8
4
+ data.tar.gz: 19b49d89780da52cefe3c957ef0feee12c3cc751e40be0c7caf6280726e1a569
5
5
  SHA512:
6
- metadata.gz: 3aab3d7166e2cff5ea25905294539df647c2cece2770756d844899551807b55599b77ec9a419018a02fe9a90bb0f25f514d8e1d089ac0f94dc55346fb439cc6c
7
- data.tar.gz: 2310d1a1f729a351d96a95de146fa219f56fc39d1eb1b7dbb90959226b7ee592500bfc2b76ae68c879b172b62b3479c46aacdf57dd42be0489762159f4ba61f8
6
+ metadata.gz: e3cdaecdc4f14781d7a90a446e29e801b794ebd6e2d33d97bdecf6bcc503da995d9d5d90c92d5e5f3e57e87233fb7a9d2c4621fe84182c584512cc7158985bba
7
+ data.tar.gz: 9bb12a7e753efc7628b8200660a7f1f1748baa0abc4b95caff5c257d6855af5731bfe7c7d0492c55500e0281a71d4a565b3c6450a6309d8e9af8e6afc04bc01b
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.14'
17
+ gem 'recurly', '~> 2.18.19'
18
18
  ```
19
19
 
20
20
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
data/lib/recurly.rb CHANGED
@@ -40,6 +40,7 @@ module Recurly
40
40
  require 'recurly/gift_card'
41
41
  require 'recurly/purchase'
42
42
  require 'recurly/webhook'
43
+ require 'recurly/verify'
43
44
  require 'recurly/tier'
44
45
 
45
46
  @subdomain = nil
@@ -124,6 +124,25 @@ module Recurly
124
124
  raise Invalid, e.message
125
125
  end
126
126
 
127
+ def create_billing_info(billing_info)
128
+ billing_info = billing_info
129
+ billing_info.uri = "#{path}/billing_infos"
130
+ billing_info.save!
131
+ billing_info
132
+ end
133
+
134
+ def get_billing_infos
135
+ Pager.new(Recurly::BillingInfo, uri: "#{path}/billing_infos", parent: self)
136
+ rescue Recurly::API::UnprocessableEntity => e
137
+ raise Invalid, e.message
138
+ end
139
+
140
+ def get_billing_info(billing_info_uuid)
141
+ BillingInfo.from_response API.get("#{path}/billing_infos/#{billing_info_uuid}")
142
+ rescue Recurly::API::UnprocessableEntity => e
143
+ raise Invalid, e.message
144
+ end
145
+
127
146
  # Reopen an account.
128
147
  #
129
148
  # @return [true, false] +true+ when successful, +false+ when unable to
@@ -9,6 +9,7 @@ module Recurly
9
9
  add_on_code
10
10
  item_code
11
11
  name
12
+ item_state
12
13
  accounting_code
13
14
  default_quantity
14
15
  unit_amount_in_cents
@@ -23,6 +24,7 @@ module Recurly
23
24
  created_at
24
25
  updated_at
25
26
  tier_type
27
+ external_sku
26
28
  avalara_service_type
27
29
  avalara_transaction_type
28
30
  )
@@ -8,7 +8,7 @@ module Recurly
8
8
  AMAZON_ATTRIBUTES = %w(amazon_billing_agreement_id amazon_region).freeze
9
9
  PAYPAL_ATTRIBUTES = %w(paypal_billing_agreement_id).freeze
10
10
  ROKU_ATTRIBUTES = %w(roku_billing_agreement_id last_four).freeze
11
- SEPA_ATTRIBUTES = %w(iban).freeze
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
14
 
@@ -16,6 +16,7 @@ module Recurly
16
16
  belongs_to :account
17
17
 
18
18
  define_attribute_methods %w(
19
+ uuid
19
20
  first_name
20
21
  last_name
21
22
  company
@@ -42,8 +43,19 @@ module Recurly
42
43
  mandate_reference
43
44
  tax_identifier
44
45
  tax_identifier_type
46
+ primary_payment_method
47
+ backup_payment_method
45
48
  ) | CREDIT_CARD_ATTRIBUTES | BANK_ACCOUNT_ATTRIBUTES | AMAZON_ATTRIBUTES | PAYPAL_ATTRIBUTES | ROKU_ATTRIBUTES | SEPA_ATTRIBUTES | BACS_ATTRIBUTES | BECS_ATTRIBUTES
46
49
 
50
+ # Verify an account's stored billing info
51
+ #
52
+ # @param [Hash] gateway_code (optional) is the code for the gateway to use for verification. If unspecified, a gateway will be selected using the normal rules.
53
+ # @return [Transaction]
54
+ # @raise [Invalid] Raise if the account's billing info cannot be verified
55
+ def verify(attrs = {})
56
+ Transaction.from_response API.post("#{path}/verify", attrs.empty? ? nil : Verify.to_xml(attrs))
57
+ end
58
+
47
59
  # @return [String]
48
60
  def inspect
49
61
  attributes = self.class.attribute_names
@@ -46,6 +46,8 @@ module Recurly
46
46
  unique_template_code
47
47
  free_trial_amount
48
48
  free_trial_unit
49
+ applies_to_all_items
50
+ item_codes
49
51
  )
50
52
  alias to_param coupon_code
51
53
 
@@ -51,6 +51,9 @@ module Recurly
51
51
  # @return [Invoice, nil]
52
52
  has_one :original_invoice, class_name: :Invoice, readonly: true
53
53
 
54
+ # @return [BillingInfo, nil]
55
+ has_one :billing_info, class_name: :BillingInfo, readonly: true
56
+
54
57
  # Returns the first redemption in the Invoice's redemptions.
55
58
  # This was placed here for backwards compatibility when we went from
56
59
  # having a single redemption per invoice to multiple redemptions per invoice.
@@ -111,6 +114,7 @@ module Recurly
111
114
  gateway_code
112
115
  surcharge_in_cents
113
116
  tax_details
117
+ billing_info_uuid
114
118
  )
115
119
  alias to_param invoice_number_with_prefix
116
120
 
@@ -203,6 +207,9 @@ module Recurly
203
207
  self.class.from_response(
204
208
  follow_link :refund, :body => refund_line_items_to_xml(line_items, refund_method, options)
205
209
  )
210
+ rescue Recurly::API::UnprocessableEntity => e
211
+ Transaction::Error.validate! e, (self if is_a?(Transaction))
212
+ raise
206
213
  end
207
214
 
208
215
  # Refunds the invoice for a specific amount.
@@ -128,6 +128,9 @@ module Recurly
128
128
  # @return [[ShippingFee], nil]
129
129
  has_many :shipping_fees, class_name: :ShippingFee, readonly: false
130
130
 
131
+ # @return [BillingInfo, nil]
132
+ has_one :billing_info, class_name: :BillingInfo, readonly: true
133
+
131
134
  define_attribute_methods %w(
132
135
  currency
133
136
  collection_method
@@ -140,6 +143,7 @@ module Recurly
140
143
  shipping_address_id
141
144
  gateway_code
142
145
  transaction_type
146
+ billing_info_uuid
143
147
  )
144
148
 
145
149
  class << self
@@ -85,6 +85,7 @@ module Recurly
85
85
  timeframe
86
86
  started_with_gift
87
87
  converted_at
88
+ billing_info_uuid
88
89
  no_billing_info_reason
89
90
  imported_trial
90
91
  credit_customer_notes
@@ -176,7 +177,7 @@ module Recurly
176
177
 
177
178
  # Convert free trial to paid subscription when transaction_type is "moto"
178
179
  # which stands for "Mail Order Telephone Order".
179
- #
180
+ #
180
181
  # @return true
181
182
  def convert_trial_moto()
182
183
  builder = XML.new("<subscription/>")
@@ -186,8 +187,8 @@ module Recurly
186
187
  end
187
188
 
188
189
  # Convert free trial to paid subscription. Optionally uses a 3ds token.
189
- #
190
- # @param three_d_secure_action_result_token_id [String] three_d_secure_action_result_token_id
190
+ #
191
+ # @param three_d_secure_action_result_token_id [String] three_d_secure_action_result_token_id
191
192
  # returned by Recurly.js referencing the result of the 3DS authentication for PSD2
192
193
  # @return true when payment is accepted
193
194
  def convert_trial(three_d_secure_action_result_token_id = nil)
@@ -198,8 +199,8 @@ module Recurly
198
199
  billing_info.add_element('three_d_secure_action_result_token_id', three_d_secure_action_result_token_id)
199
200
  builder.to_s
200
201
  end
201
-
202
- reload API.put("#{uri}/convert_trial", body)
202
+
203
+ reload API.put("#{uri}/convert_trial", body)
203
204
  true
204
205
  end
205
206
 
@@ -0,0 +1,12 @@
1
+ module Recurly
2
+ class Verify < Resource
3
+ define_attribute_methods %w(
4
+ gateway_code
5
+ )
6
+
7
+ def self.to_xml(attrs)
8
+ verify = new attrs
9
+ verify.to_xml
10
+ end
11
+ end
12
+ end
@@ -1,6 +1,6 @@
1
1
  module Recurly
2
2
  module Version
3
- VERSION = "2.18.14"
3
+ VERSION = "2.18.19"
4
4
 
5
5
  class << self
6
6
  def inspect
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.14
4
+ version: 2.18.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-20 00:00:00.000000000 Z
11
+ date: 2021-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -118,88 +118,6 @@ dependencies:
118
118
  - - "~>"
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
- - !ruby/object:Gem::Dependency
122
- name: yard
123
- requirement: !ruby/object:Gem::Requirement
124
- requirements:
125
- - - "~>"
126
- - !ruby/object:Gem::Version
127
- version: 0.9.9
128
- type: :development
129
- prerelease: false
130
- version_requirements: !ruby/object:Gem::Requirement
131
- requirements:
132
- - - "~>"
133
- - !ruby/object:Gem::Version
134
- version: 0.9.9
135
- - !ruby/object:Gem::Dependency
136
- name: redcarpet
137
- requirement: !ruby/object:Gem::Requirement
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- version: 3.4.0
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: '3.4'
145
- type: :development
146
- prerelease: false
147
- version_requirements: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- version: 3.4.0
152
- - - "~>"
153
- - !ruby/object:Gem::Version
154
- version: '3.4'
155
- - !ruby/object:Gem::Dependency
156
- name: racc
157
- requirement: !ruby/object:Gem::Requirement
158
- requirements:
159
- - - "~>"
160
- - !ruby/object:Gem::Version
161
- version: '1'
162
- type: :development
163
- prerelease: false
164
- version_requirements: !ruby/object:Gem::Requirement
165
- requirements:
166
- - - "~>"
167
- - !ruby/object:Gem::Version
168
- version: '1'
169
- - !ruby/object:Gem::Dependency
170
- name: pry
171
- requirement: !ruby/object:Gem::Requirement
172
- requirements:
173
- - - ">="
174
- - !ruby/object:Gem::Version
175
- version: 0.9.10
176
- - - "<"
177
- - !ruby/object:Gem::Version
178
- version: 0.11.0
179
- type: :development
180
- prerelease: false
181
- version_requirements: !ruby/object:Gem::Requirement
182
- requirements:
183
- - - ">="
184
- - !ruby/object:Gem::Version
185
- version: 0.9.10
186
- - - "<"
187
- - !ruby/object:Gem::Version
188
- version: 0.11.0
189
- - !ruby/object:Gem::Dependency
190
- name: pry-nav
191
- requirement: !ruby/object:Gem::Requirement
192
- requirements:
193
- - - "~>"
194
- - !ruby/object:Gem::Version
195
- version: 0.2.4
196
- type: :development
197
- prerelease: false
198
- version_requirements: !ruby/object:Gem::Requirement
199
- requirements:
200
- - - "~>"
201
- - !ruby/object:Gem::Version
202
- version: 0.2.4
203
121
  description: 'An API client library for Recurly: https://recurly.com'
204
122
  email: support@recurly.com
205
123
  executables: []
@@ -253,6 +171,7 @@ files:
253
171
  - lib/recurly/transaction.rb
254
172
  - lib/recurly/transaction/errors.rb
255
173
  - lib/recurly/usage.rb
174
+ - lib/recurly/verify.rb
256
175
  - lib/recurly/version.rb
257
176
  - lib/recurly/webhook.rb
258
177
  - lib/recurly/webhook/account_notification.rb