Class: Ingenico::Connect::SDK::Merchant::Payments::PaymentsClient

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

Overview

Payments client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ PaymentsClient

Returns a new instance of PaymentsClient.

Parameters:



35
36
37
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 35

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

Instance Method Details

#approve(payment_id, body, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Payment::PaymentApprovalResponse

Resource /{merchantId}/payments/{paymentId}/approve - Approve payment

Parameters:

Returns:

Raises:



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 264

def approve(payment_id, body, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/approve', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Payment::PaymentApprovalResponse,
    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(payment_id, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Payment::CancelPaymentResponse

Resource /{merchantId}/payments/{paymentId}/cancel - Cancel payment

Parameters:

Returns:

Raises:



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 451

def cancel(payment_id, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/cancel', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Ingenico::Connect::SDK::Domain::Payment::CancelPaymentResponse,
    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(payment_id, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Payment::CancelApprovalPaymentResponse

Resource /{merchantId}/payments/{paymentId}/cancelapproval - Undo capture payment

Parameters:

Returns:

Raises:



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 327

def cancelapproval(payment_id, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/cancelapproval', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Ingenico::Connect::SDK::Domain::Payment::CancelApprovalPaymentResponse,
    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

#capture(payment_id, body, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Capture::CaptureResponse

Resource /{merchantId}/payments/{paymentId}/capture - Capture payment

Parameters:

Returns:

Raises:



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 296

def capture(payment_id, body, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/capture', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Capture::CaptureResponse,
    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

#captures(payment_id, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Capture::CapturesResponse

Resource /{merchantId}/payments/{paymentId}/captures - Get captures of payment

Parameters:

Returns:

Raises:



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 358

def captures(payment_id, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/captures', path_context)
  return @communicator.get(
    uri,
    client_headers,
    nil,
    Ingenico::Connect::SDK::Domain::Capture::CapturesResponse,
    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

#complete(payment_id, body, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Payment::CompletePaymentResponse

Resource /{merchantId}/payments/{paymentId}/complete - Complete payment

Parameters:

Returns:

Raises:



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 139

def complete(payment_id, body, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/complete', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Payment::CompletePaymentResponse,
    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::Payment::CreatePaymentResponse

Resource /{merchantId}/payments - Create payment

Parameters:

Returns:

Raises:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 53

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

#dispute(payment_id, body, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Dispute::DisputeResponse

Resource /{merchantId}/payments/{paymentId}/dispute - Create dispute

Parameters:

Returns:

Raises:



483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 483

def dispute(payment_id, body, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/dispute', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Dispute::DisputeResponse,
    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

#disputes(payment_id, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Dispute::DisputesResponse

Resource /{merchantId}/payments/{paymentId}/disputes - Get disputes

Parameters:

Returns:

Raises:



514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 514

def disputes(payment_id, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/disputes', path_context)
  return @communicator.get(
    uri,
    client_headers,
    nil,
    Ingenico::Connect::SDK::Domain::Dispute::DisputesResponse,
    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

#find(query, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Payment::FindPaymentsResponse

Resource /{merchantId}/payments - Find payments

Parameters:

Returns:

Raises:



81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 81

def find(query, context=nil)
  uri = instantiate_uri('/v1/{merchantId}/payments', nil)
  return @communicator.get(
    uri,
    client_headers,
    query,
    Ingenico::Connect::SDK::Domain::Payment::FindPaymentsResponse,
    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(payment_id, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Payment::PaymentResponse

Resource /{merchantId}/payments/{paymentId} - Get payment

Parameters:

Returns:

Raises:



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

def get(payment_id, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}', path_context)
  return @communicator.get(
    uri,
    client_headers,
    nil,
    Ingenico::Connect::SDK::Domain::Payment::PaymentResponse,
    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

#processchallenged(payment_id, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Payment::PaymentResponse

Resource /{merchantId}/payments/{paymentId}/processchallenged - Approves challenged payment

Parameters:

Returns:

Raises:



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 232

def processchallenged(payment_id, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/processchallenged', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Ingenico::Connect::SDK::Domain::Payment::PaymentResponse,
    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

#refund(payment_id, body, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Refund::RefundResponse

Resource /{merchantId}/payments/{paymentId}/refund - Create refund

Parameters:

Returns:

Raises:



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 390

def refund(payment_id, body, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/refund', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Refund::RefundResponse,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Refund::RefundErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end

#refunds(payment_id, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Refund::RefundsResponse

Resource /{merchantId}/payments/{paymentId}/refunds - Get refunds of payment

Parameters:

Returns:

Raises:



421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 421

def refunds(payment_id, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/refunds', path_context)
  return @communicator.get(
    uri,
    client_headers,
    nil,
    Ingenico::Connect::SDK::Domain::Refund::RefundsResponse,
    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

#third_party_status(payment_id, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Payment::ThirdPartyStatusResponse

Resource /{merchantId}/payments/{paymentId}/thirdpartystatus - Third party status poll

Parameters:

Returns:

Raises:



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 170

def third_party_status(payment_id, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/thirdpartystatus', path_context)
  return @communicator.get(
    uri,
    client_headers,
    nil,
    Ingenico::Connect::SDK::Domain::Payment::ThirdPartyStatusResponse,
    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

#tokenize(payment_id, body, context = nil) ⇒ Ingenico::Connect::SDK::Domain::Token::CreateTokenResponse

Resource /{merchantId}/payments/{paymentId}/tokenize - Create a token from payment

Parameters:

Returns:

Raises:



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/ingenico/connect/sdk/merchant/payments/payments_client.rb', line 201

def tokenize(payment_id, body, context=nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/tokenize', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Token::CreateTokenResponse,
    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