Class: Worldline::Connect::SDK::V1::Merchant::Payouts::PayoutsClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/worldline/connect/sdk/v1/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

Returns a new instance of PayoutsClient.

Parameters:



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

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

Instance Method Details

#approve(payout_id, body, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::PayoutResponse

Resource /{merchantId}/payouts/{payoutId}/approve - Approve payout

Parameters:

Returns:

Raises:



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/worldline/connect/sdk/v1/merchant/payouts/payouts_client.rb', line 132

def approve(payout_id, body, context = nil)
  path_context = {
    'payoutId'.freeze => payout_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payouts/{payoutId}/approve', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Worldline::Connect::SDK::V1::Domain::PayoutResponse,
    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

#cancel(payout_id, context = nil) ⇒ Object

Resource /{merchantId}/payouts/{payoutId}/cancel - Cancel payout

Parameters:

Raises:



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/worldline/connect/sdk/v1/merchant/payouts/payouts_client.rb', line 163

def cancel(payout_id, context = nil)
  path_context = {
    'payoutId'.freeze => payout_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payouts/{payoutId}/cancel', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    nil,
    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

#cancelapproval(payout_id, context = nil) ⇒ Object

Resource /{merchantId}/payouts/{payoutId}/cancelapproval - Undo approve payout

Parameters:

Raises:



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/worldline/connect/sdk/v1/merchant/payouts/payouts_client.rb', line 194

def cancelapproval(payout_id, context = nil)
  path_context = {
    'payoutId'.freeze => payout_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payouts/{payoutId}/cancelapproval', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    nil,
    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

#create(body, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::PayoutResponse

Resource /{merchantId}/payouts - Create payout

Parameters:

Returns:

Raises:



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

def create(body, context = nil)
  uri = instantiate_uri('/v1/{merchantId}/payouts', nil)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Worldline::Connect::SDK::V1::Domain::PayoutResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::PayoutErrorResponse
  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

#find(query, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::FindPayoutsResponse

Resource /{merchantId}/payouts - Find payouts

Parameters:

Returns:

Raises:



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/worldline/connect/sdk/v1/merchant/payouts/payouts_client.rb', line 72

def find(query, context = nil)
  uri = instantiate_uri('/v1/{merchantId}/payouts', nil)
  @communicator.get(
    uri,
    client_headers,
    query,
    Worldline::Connect::SDK::V1::Domain::FindPayoutsResponse,
    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

#get(payout_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::PayoutResponse

Resource /{merchantId}/payouts/{payoutId} - Get payout

Parameters:

Returns:

Raises:



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/worldline/connect/sdk/v1/merchant/payouts/payouts_client.rb', line 100

def get(payout_id, context = nil)
  path_context = {
    'payoutId'.freeze => payout_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payouts/{payoutId}', path_context)
  @communicator.get(
    uri,
    client_headers,
    nil,
    Worldline::Connect::SDK::V1::Domain::PayoutResponse,
    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