Class: Worldline::Acquiring::SDK::V1::Acquirer::Merchant::Refunds::RefundsClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/worldline/acquiring/sdk/v1/acquirer/merchant/refunds/refunds_client.rb

Overview

Refunds client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ RefundsClient

Returns a new instance of RefundsClient.

Parameters:



24
25
26
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/refunds/refunds_client.rb', line 24

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

Instance Method Details

#capture_refund(refund_id, body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiActionResponseForRefund

Resource /processing/v1/{acquirerId}/{merchantId}/refunds/{refundId}/captures - Capture refund

Parameters:

Returns:

Raises:



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/refunds/refunds_client.rb', line 101

def capture_refund(refund_id, body, context = nil)
  path_context = {
    'refundId'.freeze => refund_id,
  }
  uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/refunds/{refundId}/captures', path_context)
  @communicator.post(
    uri,
nil,
    nil,
    body,
    Worldline::Acquiring::SDK::V1::Domain::ApiActionResponseForRefund,
    context)
rescue Worldline::Acquiring::SDK::Communication::ResponseException => e
  error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#get_refund(refund_id, query, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiRefundResource

Resource /processing/v1/{acquirerId}/{merchantId}/refunds/{refundId} - Retrieve refund

Parameters:

Returns:

Raises:



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/refunds/refunds_client.rb', line 70

def get_refund(refund_id, query, context = nil)
  path_context = {
    'refundId'.freeze => refund_id,
  }
  uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/refunds/{refundId}', path_context)
  @communicator.get(
    uri,
nil,
    query,
    Worldline::Acquiring::SDK::V1::Domain::ApiRefundResource,
    context)
rescue Worldline::Acquiring::SDK::Communication::ResponseException => e
  error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#process_standalone_refund(body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiRefundResponse

Resource /processing/v1/{acquirerId}/{merchantId}/refunds - Create standalone refund

Parameters:

Returns:

Raises:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/refunds/refunds_client.rb', line 41

def process_standalone_refund(body, context = nil)
  uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/refunds', nil)
  @communicator.post(
    uri,
nil,
    nil,
    body,
    Worldline::Acquiring::SDK::V1::Domain::ApiRefundResponse,
    context)
rescue Worldline::Acquiring::SDK::Communication::ResponseException => e
  error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#reverse_refund_authorization(refund_id, body, context = nil) ⇒ Worldline::Acquiring::SDK::V1::Domain::ApiActionResponseForRefund

Resource /processing/v1/{acquirerId}/{merchantId}/refunds/{refundId}/authorization-reversals - Reverse refund authorization

Parameters:

Returns:

Raises:



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/worldline/acquiring/sdk/v1/acquirer/merchant/refunds/refunds_client.rb', line 133

def reverse_refund_authorization(refund_id, body, context = nil)
  path_context = {
    'refundId'.freeze => refund_id,
  }
  uri = instantiate_uri('/processing/v1/{acquirerId}/{merchantId}/refunds/{refundId}/authorization-reversals', path_context)
  @communicator.post(
    uri,
nil,
    nil,
    body,
    Worldline::Acquiring::SDK::V1::Domain::ApiActionResponseForRefund,
    context)
rescue Worldline::Acquiring::SDK::Communication::ResponseException => e
  error_type = Worldline::Acquiring::SDK::V1::Domain::ApiPaymentErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Acquiring::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end