recurly 2.19.14 → 2.20.1

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: 4853b168a6c2025885e1596a398d110300d73fc0bd4411c20a7f426bedeec728
4
- data.tar.gz: 7c5a17e1d0c78db2e2c99252740fff6a2a14e9c7fc228b2fadb4698b3eb0883d
3
+ metadata.gz: d29c25aaafb1e7cde4ff0c6c3511bf672c10d5664b1223ccdb522cfed3b3a2de
4
+ data.tar.gz: ecd2e55f489d5ee557b5a2b0bc21cb88f19195b9815c046a36e90f66cbae5a20
5
5
  SHA512:
6
- metadata.gz: 1f399696922dd5b30171a2775e5395ebc0d7c524d9509220bf21bcd9dc44a54046ca60db27a6d9fcb612455c9171c854716e50812884370f8e8d85358cd34ba9
7
- data.tar.gz: d56c91136f20ce5b730ff4cb22a6307824cc5fc6882510f0377d3e72dc36bc6038d23f56292a4fe91aaa9a119fe901859188afb3b25354ac01dd0d955c1c9aad
6
+ metadata.gz: 014674a8200bbc58eba2a0238062da93c6f822b394e09d5031802504c9115efae0f380b7ca6ec3ff27a4c57b58f83656e8a823bd882c9ef4ecfe4fb38b3888bd
7
+ data.tar.gz: 332d7c771d10ceed0353a44c19f370235c8ea261f611803d56d3a914edfa47d05fc012d4e9ece51369bbeb82a558c0c1ee3b5fb9f113a628f06272de97ef2918
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.19.14'
17
+ gem 'recurly', '~> 2.20.1'
18
18
  ```
19
19
 
20
20
  Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
@@ -55,6 +55,8 @@ module Recurly
55
55
  tax_type
56
56
  tax_region
57
57
  tax_rate
58
+ origin_tax_address_source
59
+ destination_tax_address_source
58
60
  tax_exempt
59
61
  tax_inclusive
60
62
  tax_code
@@ -13,6 +13,8 @@ module Recurly
13
13
  name
14
14
  invoice_display_address
15
15
  tax_address
16
+ origin_tax_address_source
17
+ destination_tax_address_source
16
18
  subscriber_location_countries
17
19
  default_vat_number
18
20
  default_registration_number
@@ -30,6 +30,8 @@ module Recurly
30
30
  trial_ends_at
31
31
  canceled_at
32
32
  in_grace_period
33
+ imported
34
+ test
33
35
  )
34
36
 
35
37
  # We do not expose PUT or POST in the v2 API.
@@ -47,5 +49,9 @@ module Recurly
47
49
  rescue Recurly::API::UnprocessableEntity => e
48
50
  raise Invalid, e.message
49
51
  end
52
+
53
+ def self.find_by_external_id(external_id)
54
+ self.find("external-id-#{external_id}")
55
+ end
50
56
  end
51
57
  end
@@ -249,6 +249,25 @@ module Recurly
249
249
  )
250
250
  end
251
251
 
252
+ # Refunds the invoice for a specific percentage.
253
+ #
254
+ # @return [Invoice, false] Invoice if successful, false if the invoice isn't
255
+ # refundable.
256
+ # @raise [Error] If the refund fails.
257
+ # @param percentage [Integer, nil] The percentage to refund from the invoice.
258
+ # @param refund_method ["credit_first", "transaction_first", "all_transaction", "all_credit"] The method used to refund.
259
+ # @param external_refund [true, false] Designates that the refund transactions created are manual.
260
+ # @param credit_customer_notes [String] Adds notes to refund credit invoice.
261
+ # @param payment_method [String] Creates the manual transactions with this payment method. Allowed if *external_refund* is true.
262
+ # @param description [String] Sets this value as the *transaction_note* on the manual transactions created. Allowed if *external_refund* is true.
263
+ # @param refunded_at [DateTime] Sets this value as the *collected_at* on the manual transactions created. Allowed if *external_refund* is true.
264
+ def refund_percentage(percentage = nil, refund_method = 'credit_first', options = {})
265
+ return false unless link? :refund
266
+ self.class.from_response(
267
+ follow_link :refund, :body => refund_percentage_to_xml(percentage, refund_method, options)
268
+ )
269
+ end
270
+
252
271
  def xml_keys
253
272
  super - ['currency']
254
273
  end
@@ -285,6 +304,16 @@ module Recurly
285
304
  builder.to_s
286
305
  end
287
306
 
307
+ def refund_percentage_to_xml(percentage = nil, refund_method = nil, options = {})
308
+ builder = XML.new("<invoice/>")
309
+ builder.add_element 'refund_method', refund_method
310
+ builder.add_element 'percentage', percentage
311
+ options.each do |k, v|
312
+ builder.add_element k.to_s, v
313
+ end
314
+ builder.to_s
315
+ end
316
+
288
317
  def refund_line_items_to_xml(line_items = nil, refund_method = nil, options = {})
289
318
  builder = XML.new("<invoice/>")
290
319
  builder.add_element 'refund_method', refund_method
@@ -296,8 +325,10 @@ module Recurly
296
325
  line_items.each do |line_item|
297
326
  adj_node = node.add_element 'adjustment'
298
327
  adj_node.add_element 'uuid', line_item[:adjustment].uuid
299
- adj_node.add_element 'quantity', line_item[:quantity]
328
+ adj_node.add_element 'quantity', line_item[:quantity] if line_item.key?(:quantity)
300
329
  adj_node.add_element('quantity_decimal', line_item[:quantity_decimal]) if line_item.key?(:quantity_decimal)
330
+ adj_node.add_element 'percentage', line_item[:percentage] if line_item.key?(:percentage)
331
+ adj_node.add_element 'amount_in_cents', line_item[:amount_in_cents] if line_item.key?(:amount_in_cents)
301
332
  adj_node.add_element 'prorate', line_item[:prorate]
302
333
  end
303
334
  builder.to_s
@@ -1,6 +1,6 @@
1
1
  module Recurly
2
2
  module Version
3
- VERSION = "2.19.14"
3
+ VERSION = "2.20.1"
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.19.14
4
+ version: 2.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recurly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-08 00:00:00.000000000 Z
11
+ date: 2024-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri