Class: Ingenico::Connect::SDK::Merchant::Payouts::PayoutsClient

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

Overview

Payouts client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ PayoutsClient

parent

ApiResource

path_context

Hash of String to String



20
21
22
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 20

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

Instance Method Details

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

Resource /{merchantId}/payouts/{payoutId}/approve

_merchantId__payouts__payoutId__approve_post Approve payout

payout_id

String

body

Domain::Payout::ApprovePayoutRequest

context

CallContext

Returns

Domain::Payout::PayoutResponse

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



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 107

def approve(payout_id, body, context=nil)
  path_context = {
    'payoutId' => payout_id,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/payouts/{payoutId}/approve', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Payout::PayoutResponse,
    context)
rescue ResponseException => e
  error_type = {
    402 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
  }.fetch(e.status_code, 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(payout_id, context = nil) ⇒ Object

Resource /{merchantId}/payouts/{payoutId}/cancel

_merchantId__payouts__payoutId__cancel_post Cancel payout

payout_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



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 141

def cancel(payout_id, context=nil)
  path_context = {
    'payoutId' => payout_id,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/payouts/{payoutId}/cancel', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    nil,
    context)
rescue ResponseException => e
  error_type = {
    402 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
  }.fetch(e.status_code, 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(payout_id, context = nil) ⇒ Object

Resource /{merchantId}/payouts/{payoutId}/cancelapproval

_merchantId__payouts__payoutId__cancelapproval_post Undo approve payout

payout_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



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 175

def cancelapproval(payout_id, context=nil)
  path_context = {
    'payoutId' => payout_id,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/payouts/{payoutId}/cancelapproval', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    nil,
    context)
rescue ResponseException => e
  error_type = {
    405 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
  }.fetch(e.status_code, 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

#create(body, context = nil) ⇒ Object

Resource /{merchantId}/payouts

_merchantId__payouts_post Create payout

body

Domain::Payout::CreatePayoutRequest

context

CallContext

Returns

Domain::Payout::PayoutResponse

Raises

DeclinedPayoutException if the GlobalCollect platform declined / rejected the payout. The payout result will be available from the exception.

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



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 40

def create(body, context=nil)
  uri = instantiate_uri('/{apiVersion}/{merchantId}/payouts', nil)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Payout::PayoutResponse,
    context)
rescue ResponseException => e
  error_type = {
    400 => Ingenico::Connect::SDK::Domain::Payout::PayoutErrorResponse,
  }.fetch(e.status_code, 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(payout_id, context = nil) ⇒ Object

Resource /{merchantId}/payouts/{payoutId}

_merchantId__payouts__payoutId__get Get payout

payout_id

String

context

CallContext

Returns

Domain::Payout::PayoutResponse

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 72

def get(payout_id, context=nil)
  path_context = {
    'payoutId' => payout_id,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/payouts/{payoutId}', path_context)
  return @communicator.get(
    uri,
    client_headers,
    nil,
    Ingenico::Connect::SDK::Domain::Payout::PayoutResponse,
    context)
rescue ResponseException => e
  error_type = {
    404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
  }.fetch(e.status_code, 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