Search code examples
ruby-on-railsrubybalanced-payments

When attempting to void a Hold on balanced payments that had been captured, why is the response a Hold with is_void == true?


When using the Balanced Payments ruby gem (https://github.com/balanced/balanced-ruby), and using the Balanced::Hold#void method on a Balanced::Hold instance that is captured, we are getting a Balanced::Hold back that has its is_void property set to true.

That doesn't seem to make sense... is this the desired functionality?

Here's the output from the rails console: https://gist.github.com/3063419

I am not sure if this is desired functionality. Happy to log it as an issue if someone thinks this doesn't make sense.


Solution

  • Ah, it seems that the Balanced client, in lib/balanced/resources/hold.rb#L26 does not handle an exception thrown when save is invoked.

    The proper fix would be:

    def void
      self.is_void = true
      begin
         save
      rescue Balanced::Error
         self.is_void = false
         raise
      end
    end
    

    I'll file a github issue.