Class: Inttegro::Resources::Refunds
- Inherits:
-
Object
- Object
- Inttegro::Resources::Refunds
- Defined in:
- lib/inttegro/resources/refunds.rb
Overview
Client for creating, canceling, and observing refunds.
Access this resource through Client#refunds.
Instance Method Summary collapse
-
#cancel(refund_id:, reason: nil) ⇒ Inttegro::Refund
Cancel a pending refund before processing claims it.
-
#create(payload) ⇒ Inttegro::Refund
Start a refund for paid order line items.
-
#initialize(http) ⇒ Refunds
constructor
A new instance of Refunds.
-
#lookup(refund_id:) ⇒ Inttegro::Refund
Retrieve the current lifecycle state and amounts for one refund.
-
#page(payload) ⇒ Inttegro::Refund::Page
Retrieve a page of refunds.
Constructor Details
#initialize(http) ⇒ Refunds
Returns a new instance of Refunds.
11 12 13 |
# File 'lib/inttegro/resources/refunds.rb', line 11 def initialize(http) @http = T.let(http, Inttegro::HTTPClient) end |
Instance Method Details
#cancel(refund_id:, reason: nil) ⇒ Inttegro::Refund
Cancel a pending refund before processing claims it.
28 29 30 31 32 33 34 35 36 |
# File 'lib/inttegro/resources/refunds.rb', line 28 def cancel(refund_id:, reason: nil) payload = T.let({ refund_id: refund_id }, Inttegro::Types::Payload) payload[:reason] = reason unless reason.nil? @http.post_resource( "/refunds/cancel", Inttegro::Refund, :refund, payload ) end |
#create(payload) ⇒ Inttegro::Refund
Start a refund for paid order line items.
19 20 21 |
# File 'lib/inttegro/resources/refunds.rb', line 19 def create(payload) @http.post_resource("/refunds/create", Inttegro::Refund, :refund, payload) end |
#lookup(refund_id:) ⇒ Inttegro::Refund
Retrieve the current lifecycle state and amounts for one refund.
42 43 44 45 46 47 48 |
# File 'lib/inttegro/resources/refunds.rb', line 42 def lookup(refund_id:) @http.post_resource( "/refunds/lookup", Inttegro::Refund, :refund, { refund_id: refund_id } ) end |
#page(payload) ⇒ Inttegro::Refund::Page
Retrieve a page of refunds.
54 55 56 |
# File 'lib/inttegro/resources/refunds.rb', line 54 def page(payload) @http.post_resource("/refunds/page", Inttegro::Refund::Page, :page, payload) end |