Sha256: bd0c6e1f0b72d8f0f5b3cd4063abb7cb231f4fa7a3f2f48c7ca1c21761099d82

Contents?: true

Size: 776 Bytes

Versions: 5

Compression:

Stored size: 776 Bytes

Contents

module Pin
  ##
  # This class models Pin's Charges API
  class Refund < Base

    ##
    # Find a refund by charge token
    # returns: a collection of refund objects
    # args: token (String)
    # https://pin.net.au/docs/api/refunds#get-refunds
    def self.find(token)
      build_collection_response(auth_get("charges/#{token}/refunds"))
    end

    ##
    # Create a refund for a charge
    # args: token (String), amount (String - optional)
    # returns: a refund object
    # if no amount is passed in, the full amount of the charge will be refunded
    # https://pin.net.au/docs/api/refunds#post-refunds
    def self.create(token, amount = nil)
      options = {amount: amount}
      build_response(auth_post("charges/#{token}/refunds", options))
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pin_up-0.4.2 lib/pin_up/refund.rb
pin_up-0.4.1 lib/pin_up/refund.rb
pin_up-0.3.1 lib/pin_up/refund.rb
pin_up-0.3.0 lib/pin_up/refund.rb
pin_up-0.2.0 lib/pin_up/refund.rb