Class: Worldline::Connect::SDK::V1::Merchant::Payments::PaymentsClient

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



39
40
41
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 39

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

Instance Method Details

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

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

Parameters:

Returns:

Raises:



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 276

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

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

Parameters:

Returns:

Raises:



469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 469

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

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

Parameters:

Returns:

Raises:



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 341

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

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

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

Parameters:

Returns:

Raises:



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 309

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

#captures(payment_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::CapturesResponse

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

Parameters:

Returns:

Raises:



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 373

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

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

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

Parameters:

Returns:

Raises:



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 147

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

Resource /{merchantId}/payments - Create payment

Parameters:

Returns:

Raises:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 58

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

#devicefingerprint(payment_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::DeviceFingerprintDetails

Resource /{merchantId}/payments/{paymentId}/devicefingerprint - Get Device Fingerprint details

Parameters:

Returns:

Raises:



565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 565

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

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

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

Parameters:

Returns:

Raises:



502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 502

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

#disputes(payment_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::DisputesResponse

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

Parameters:

Returns:

Raises:



534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 534

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

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

Resource /{merchantId}/payments - Find payments

Parameters:

Returns:

Raises:



87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 87

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

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

Parameters:

Returns:

Raises:



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 115

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

#processchallenged(payment_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::PaymentResponse

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

Parameters:

Returns:

Raises:



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 243

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

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

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

Parameters:

Returns:

Raises:



406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 406

def refund(payment_id, body, context = nil)
  path_context = {
    'paymentId'.freeze => payment_id,
  }
  uri = instantiate_uri('/v1/{merchantId}/payments/{paymentId}/refund', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Worldline::Connect::SDK::V1::Domain::RefundResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::RefundErrorResponse
  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

#refunds(payment_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::RefundsResponse

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

Parameters:

Returns:

Raises:



438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 438

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

#third_party_status(payment_id, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::ThirdPartyStatusResponse

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

Parameters:

Returns:

Raises:



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 179

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

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

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

Parameters:

Returns:

Raises:



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/worldline/connect/sdk/v1/merchant/payments/payments_client.rb', line 211

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