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



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

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

Instance Method Details

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

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

Raises:



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 126

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,
    Ingenico::Connect::SDK::Domain::Payout::PayoutResponse,
    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(payout_id, context = nil) ⇒ Object

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

Raises:



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 156

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 = 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 - Undo approve payout

Raises:



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 186

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 = 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) ⇒ Ingenico::Connect::SDK::Domain::Payout::PayoutResponse

Resource /{merchantId}/payouts - Create payout

Raises:



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

def create(body, context = nil)
  uri = instantiate_uri('/v1/{merchantId}/payouts', nil)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Payout::PayoutResponse,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Payout::PayoutErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

#find(query, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Payout::FindPayoutsResponse

Resource /{merchantId}/payouts - Find payouts

Raises:



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 68

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

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

Raises:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/ingenico/connect/sdk/merchant/payouts/payouts_client.rb', line 95

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,
    Ingenico::Connect::SDK::Domain::Payout::PayoutResponse,
    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