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 +4 -4
- data/README.md +1 -1
- data/lib/recurly/adjustment.rb +2 -0
- data/lib/recurly/business_entity.rb +2 -0
- data/lib/recurly/external_subscription.rb +6 -0
- data/lib/recurly/invoice.rb +32 -1
- data/lib/recurly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d29c25aaafb1e7cde4ff0c6c3511bf672c10d5664b1223ccdb522cfed3b3a2de
|
4
|
+
data.tar.gz: ecd2e55f489d5ee557b5a2b0bc21cb88f19195b9815c046a36e90f66cbae5a20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
17
|
+
gem 'recurly', '~> 2.20.1'
|
18
18
|
```
|
19
19
|
|
20
20
|
Recurly will automatically use [Nokogiri](http://nokogiri.org/) (for a nice
|
data/lib/recurly/adjustment.rb
CHANGED
@@ -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
|
data/lib/recurly/invoice.rb
CHANGED
@@ -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
|
data/lib/recurly/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2024-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|