Class: Worldline::Connect::SDK::V1::Merchant::Captures::CapturesClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/worldline/connect/sdk/v1/merchant/captures/captures_client.rb

Overview

Captures client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ CapturesClient

Returns a new instance of CapturesClient.

Parameters:



24
25
26
# File 'lib/worldline/connect/sdk/v1/merchant/captures/captures_client.rb', line 24

def initialize(parent, path_context)
  super(parent: parent, path_context: path_context)
end

Instance Method Details

#get(capture_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::CaptureResponse

Resource /{merchantId}/captures/{captureId} - Get capture

Parameters:

Returns:

Raises:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/worldline/connect/sdk/v1/merchant/captures/captures_client.rb', line 42

def get(capture_id, context = nil)
  path_context = {
    'captureId'.freeze => capture_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/captures/{captureId}', path_context)
  @communicator.get(
    uri,
    client_headers,
    nil,
    Worldline::Connect::SDK::V1::Domain::CaptureResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#refund(capture_id, body, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::RefundResponse

Resource /{merchantId}/captures/{captureId}/refund - Create Refund

Parameters:

Returns:

Raises:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/worldline/connect/sdk/v1/merchant/captures/captures_client.rb', line 75

def refund(capture_id, body, context = nil)
  path_context = {
    'captureId'.freeze => capture_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/captures/{captureId}/refund', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Worldline::Connect::SDK::V1::Domain::RefundResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::RefundErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end