lib/recurly/invoice.rb in recurly-2.13.1 vs lib/recurly/invoice.rb in recurly-2.14.0
- old
+ new
@@ -113,16 +113,19 @@
reload follow_link :mark_successful
true
end
# Marks an invoice as failing collection.
+ # Returns a new {InvoiceCollection} and does not
+ # reload this invoice.
#
- # @return [true, false] +true+ when successful, +false+ when unable to
+ # @return [InvoiceCollection, false] InvoiceCollection when successful, +false+ when unable to
# (e.g., the invoice is no longer open).
def mark_failed
return false unless link? :mark_failed
- reload follow_link :mark_failed
- true
+ InvoiceCollection.from_response follow_link(:mark_failed)
+ rescue Recurly::API::UnprocessableEntity => e
+ raise Invalid, e.message
end
# Initiate a collection attempt on an invoice.
#
# @return [true, false] +true+ when successful, +false+ when unable to