class Paylike::Transaction
Transactions endpoint resource
Public Class Methods
create(*args)
click to toggle source
Delegate the resource creation to the gateway, but maintain the rest
@return [Paylike::Transaction] instance
# File lib/paylike.rb, line 51 def self.create(*args) gw_tran = Gateway::Transaction.create(*args) find(gw_tran.id) end
Public Instance Methods
capture(params)
click to toggle source
Capture helper
@param params [Hash] the `amount` and the `descriptor`. @return [NilClass]
# File lib/paylike.rb, line 81 def capture(params) captures_uri = self.class.uri_sans_merchant_id(id, :captures) data = self.class.request(:post, captures_uri, json: params) symbolized = JSON.parse(data.to_json, symbolize_names: true) marshal_load(symbolized) if data.is_a?(Hash) end
refund(params)
click to toggle source
Refunds helper
@param params [Hash] the `amount` and the `descriptor`. @return [NilClass]
# File lib/paylike.rb, line 70 def refund(params) refunds_uri = self.class.uri_sans_merchant_id(id, :refunds) data = self.class.request(:post, refunds_uri, json: params) symbolized = JSON.parse(data.to_json, symbolize_names: true) marshal_load(symbolized) if data.is_a?(Hash) end
void()
click to toggle source
Refunds helper
@return [NilClass]
# File lib/paylike.rb, line 59 def void voids_uri = self.class.uri_sans_merchant_id(id, :voids) data = self.class.request(:post, voids_uri, json: { amount: amount }) symbolized = JSON.parse(data.to_json, symbolize_names: true) marshal_load(symbolized) if data.is_a?(Hash) end