Class: Jet::Client::Refunds

Inherits:
Object
  • Object
show all
Defined in:
lib/jet/client/refunds.rb

Overview

Refunds client

Constant Summary collapse

STATUSES =
{
  created: 'created',
  processing: 'processing',
  accepted: 'accepted',
  rejected: 'rejected'
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Refunds

Returns a new instance of Refunds.



12
13
14
# File 'lib/jet/client/refunds.rb', line 12

def initialize(client)
  @client = client
end

Instance Method Details

#check_for_created_refunds(status) ⇒ Object



24
25
26
27
# File 'lib/jet/client/refunds.rb', line 24

def check_for_created_refunds(status)
  query_status = STATUSES[status]
  @client.rest_get_with_token("/refunds/#{query_status}")
end

#check_refund_state(refund_authorization_id) ⇒ Object



20
21
22
# File 'lib/jet/client/refunds.rb', line 20

def check_refund_state(refund_authorization_id)
  @client.rest_get_with_token("/refunds/state/#{refund_authorization_id}")
end

#create_merchant_initiated_refund(order_id, alt_refund_id, body = {}) ⇒ Object



16
17
18
# File 'lib/jet/client/refunds.rb', line 16

def create_merchant_initiated_refund(order_id, alt_refund_id, body = {})
  @client.rest_post_with_token("/refunds/#{order_id}/#{alt_refund_id}", body)
end