class Pin::Refund
This class models Pin's Charges
API
Public Class Methods
create(token, amount = nil)
click to toggle source
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 pinpayments.com/docs/api/refunds#post-refunds
# File lib/pin_up/refund.rb, line 34 def self.create(token, amount = nil) options = { amount: amount } build_response(make_request(:post, { url: "charges/#{token}/refunds", options: options } )) end
find(token, page = nil, pagination = false)
click to toggle source
Find a refund by charge token returns: a collection of refund objects args: token (String)
if pagination is passed, access the response hash with [:response] and the pagination hash with [:pagination]
pinpayments.com/docs/api/refunds#get-refunds
# File lib/pin_up/refund.rb, line 14 def self.find(token, page = nil, pagination = false) build_collection_response(make_request(:get, { url: "charges/#{token}/refunds?page=#{page}" } ), pagination) end
get(token)
click to toggle source
Returns the details of the specified refund. returns: a refund object args: token (String)
pinpayments.com/docs/api/refunds#get-refund
# File lib/pin_up/refund.rb, line 24 def self.get(token) build_response(make_request(:get, { url: "refunds/#{token}" } )) end