Class: Paylike::Transaction
- Defined in:
- lib/paylike.rb
Overview
Transactions endpoint resource
Class Method Summary collapse
-
.create(*args) ⇒ Paylike::Transaction
Delegate the resource creation to the gateway, but maintain the rest.
Instance Method Summary collapse
-
#capture(params) ⇒ NilClass
Capture helper.
-
#refund(params) ⇒ NilClass
Refunds helper.
-
#void ⇒ NilClass
Refunds helper.
Methods inherited from Resource
all, extract_error, find, parse_response, uri_sans_merchant_id
Class Method Details
.create(*args) ⇒ Paylike::Transaction
Delegate the resource creation to the gateway, but maintain the rest
51 52 53 54 |
# File 'lib/paylike.rb', line 51 def self.create(*args) gw_tran = Gateway::Transaction.create(*args) find(gw_tran.id) end |
Instance Method Details
#capture(params) ⇒ NilClass
Capture helper
81 82 83 84 85 86 |
# 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) ⇒ NilClass
Refunds helper
70 71 72 73 74 75 |
# 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 ⇒ NilClass
Refunds helper
59 60 61 62 63 64 |
# 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 |