Class: Ingenico::Connect::SDK::Merchant::Mandates::MandatesClient

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

Overview

Mandates client. Thread-safe.

Instance Attribute Summary

Attributes inherited from ApiResource

#client_meta_info, #communicator

Instance Method Summary collapse

Constructor Details

#initialize(parent, path_context) ⇒ MandatesClient

parent

ApiResource

path_context

Hash of String to String



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

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

Instance Method Details

#block(unique_mandate_reference, context = nil) ⇒ Object

Resource /{merchantId}/mandates/{uniqueMandateReference}/block

Block mandate

unique_mandate_reference

String

context

CallContext

Returns

Domain::Mandates::GetMandateResponse

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 Ingenico ePayments platform,

the Ingenico ePayments 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 Ingenico ePayments platform returned any other error



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb', line 135

def block(unique_mandate_reference, context=nil)
  path_context = {
    'uniqueMandateReference' => unique_mandate_reference,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/mandates/{uniqueMandateReference}/block', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse,
    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) ⇒ Object

Resource /{merchantId}/mandates

Create mandate

body

Domain::Mandates::CreateMandateRequest

context

CallContext

Returns

Domain::Mandates::CreateMandateResponse

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 Ingenico ePayments platform,

the Ingenico ePayments 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 Ingenico ePayments platform returned any other error



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

def create(body, context=nil)
  uri = instantiate_uri('/{apiVersion}/{merchantId}/mandates', nil)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Mandates::CreateMandateResponse,
    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_with_mandate_reference(unique_mandate_reference, body, context = nil) ⇒ Object

Resource /{merchantId}/mandates/{uniqueMandateReference}

Create mandate with mandatereference

unique_mandate_reference

String

body

Domain::Mandates::CreateMandateRequest

context

CallContext

Returns

Domain::Mandates::CreateMandateResponse

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 Ingenico ePayments platform,

the Ingenico ePayments 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 Ingenico ePayments platform returned any other error



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb', line 70

def create_with_mandate_reference(unique_mandate_reference, body, context=nil)
  path_context = {
    'uniqueMandateReference' => unique_mandate_reference,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/mandates/{uniqueMandateReference}', path_context)
  return @communicator.put(
    uri,
    client_headers,
    nil,
    body,
    Ingenico::Connect::SDK::Domain::Mandates::CreateMandateResponse,
    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(unique_mandate_reference, context = nil) ⇒ Object

Resource /{merchantId}/mandates/{uniqueMandateReference}

Get mandate

unique_mandate_reference

String

context

CallContext

Returns

Domain::Mandates::GetMandateResponse

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 Ingenico ePayments platform,

the Ingenico ePayments 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 Ingenico ePayments platform returned any other error



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/ingenico/connect/sdk/merchant/mandates/mandates_client.rb', line 103

def get(unique_mandate_reference, context=nil)
  path_context = {
    'uniqueMandateReference' => unique_mandate_reference,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/mandates/{uniqueMandateReference}', path_context)
  return @communicator.get(
    uri,
    client_headers,
    nil,
    Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse,
    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

#revoke(unique_mandate_reference, context = nil) ⇒ Object

Resource /{merchantId}/mandates/{uniqueMandateReference}/revoke

Revoke mandate

unique_mandate_reference

String

context

CallContext

Returns

Domain::Mandates::GetMandateResponse

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 Ingenico ePayments platform,

the Ingenico ePayments 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 Ingenico ePayments platform returned any other error



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

def revoke(unique_mandate_reference, context=nil)
  path_context = {
    'uniqueMandateReference' => unique_mandate_reference,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/mandates/{uniqueMandateReference}/revoke', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse,
    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

#unblock(unique_mandate_reference, context = nil) ⇒ Object

Resource /{merchantId}/mandates/{uniqueMandateReference}/unblock

Unblock mandate

unique_mandate_reference

String

context

CallContext

Returns

Domain::Mandates::GetMandateResponse

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 Ingenico ePayments platform,

the Ingenico ePayments 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 Ingenico ePayments platform returned any other error



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

def unblock(unique_mandate_reference, context=nil)
  path_context = {
    'uniqueMandateReference' => unique_mandate_reference,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/mandates/{uniqueMandateReference}/unblock', path_context)
  return @communicator.post(
    uri,
    client_headers,
    nil,
    nil,
    Ingenico::Connect::SDK::Domain::Mandates::GetMandateResponse,
    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