Class: Ingenico::Connect::SDK::Merchant::Refunds::RefundsClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/ingenico/connect/sdk/merchant/refunds/refunds_client.rb

Overview

Refunds client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ RefundsClient

parent

ApiResource

path_context

Hash of String to String



19
20
21
# File 'lib/ingenico/connect/sdk/merchant/refunds/refunds_client.rb', line 19

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

Instance Method Details

#approve(refund_id, body, context = nil) ⇒ Object

Resource /{merchantId}/refunds/{refundId}/approve

_merchantId__refunds__refundId__approve_post Approve refund

refund_id

String

body

Domain::Refund::ApproveRefundRequest

context

CallContext

Raises

ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)

Raises

AuthorizationException if the request was not allowed (HTTP status code 403)

Raises

IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)

Raises

ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,

or there was a conflict (HTTP status code 404, 409 or 410)

Raises

GlobalCollectException if something went wrong at the GlobalCollect platform,

the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,

or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Raises

ApiException if the GlobalCollect platform returned any other error



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

def approve(refund_id, body, context=nil)
  path_context = {
    'refundId' => refund_id,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/refunds/{refundId}/approve', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    nil,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

#cancel(refund_id, context = nil) ⇒ Object

Resource /{merchantId}/refunds/{refundId}/cancel

_merchantId__refunds__refundId__cancel_post Cancel refund

refund_id

String

context

CallContext

Raises

ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)

Raises

AuthorizationException if the request was not allowed (HTTP status code 403)

Raises

IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)

Raises

ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,

or there was a conflict (HTTP status code 404, 409 or 410)

Raises

GlobalCollectException if something went wrong at the GlobalCollect platform,

the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,

or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Raises

ApiException if the GlobalCollect platform returned any other error



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/ingenico/connect/sdk/merchant/refunds/refunds_client.rb', line 102

def cancel(refund_id, context=nil)
  path_context = {
    'refundId' => refund_id,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/refunds/{refundId}/cancel', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    nil,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

#cancelapproval(refund_id, context = nil) ⇒ Object

Resource /{merchantId}/refunds/{refundId}/cancelapproval

_merchantId__refunds__refundId__cancelapproval_post Undo approve refund

refund_id

String

context

CallContext

Raises

ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)

Raises

AuthorizationException if the request was not allowed (HTTP status code 403)

Raises

IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)

Raises

ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,

or there was a conflict (HTTP status code 404, 409 or 410)

Raises

GlobalCollectException if something went wrong at the GlobalCollect platform,

the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,

or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Raises

ApiException if the GlobalCollect platform returned any other error



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/ingenico/connect/sdk/merchant/refunds/refunds_client.rb', line 134

def cancelapproval(refund_id, context=nil)
  path_context = {
    'refundId' => refund_id,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/refunds/{refundId}/cancelapproval', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    nil,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

#get(refund_id, context = nil) ⇒ Object

Resource /{merchantId}/refunds/{refundId}

_merchantId__refunds__refundId__get Get refund

refund_id

String

context

CallContext

Returns

Domain::Refund::RefundResponse

Raises

ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)

Raises

AuthorizationException if the request was not allowed (HTTP status code 403)

Raises

IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)

Raises

ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,

or there was a conflict (HTTP status code 404, 409 or 410)

Raises

GlobalCollectException if something went wrong at the GlobalCollect platform,

the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,

or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Raises

ApiException if the GlobalCollect platform returned any other error



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ingenico/connect/sdk/merchant/refunds/refunds_client.rb', line 38

def get(refund_id, context=nil)
  path_context = {
    'refundId' => refund_id,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/refunds/{refundId}', path_context)
  return @communicator.get(
    uri,
    client_headers,
    nil,
    Ingenico::Connect::SDK::Domain::Refund::RefundResponse,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end