Class: OnlinePayments::SDK::Merchant::Mandates::MandatesClient
- Inherits:
-
ApiResource
- Object
- ApiResource
- OnlinePayments::SDK::Merchant::Mandates::MandatesClient
- Defined in:
- lib/onlinepayments/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
-
#block_mandate(unique_mandate_reference, context = nil) ⇒ OnlinePayments::SDK::Domain::GetMandateResponse
Resource /v2/{merchantId}/mandates/{uniqueMandateReference}/block - Block mandate.
-
#create_mandate(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CreateMandateResponse
Resource /v2/{merchantId}/mandates - Create mandate.
-
#get_mandate(unique_mandate_reference, context = nil) ⇒ OnlinePayments::SDK::Domain::GetMandateResponse
Resource /v2/{merchantId}/mandates/{uniqueMandateReference} - Get mandate.
-
#initialize(parent, path_context) ⇒ MandatesClient
constructor
A new instance of MandatesClient.
-
#revoke_mandate(unique_mandate_reference, body, context = nil) ⇒ OnlinePayments::SDK::Domain::GetMandateResponse
Resource /v2/{merchantId}/mandates/{uniqueMandateReference}/revoke - Revoke mandate.
-
#unblock_mandate(unique_mandate_reference, context = nil) ⇒ OnlinePayments::SDK::Domain::GetMandateResponse
Resource /v2/{merchantId}/mandates/{uniqueMandateReference}/unblock - Unblock mandate.
Constructor Details
#initialize(parent, path_context) ⇒ MandatesClient
Returns a new instance of MandatesClient.
20 21 22 |
# File 'lib/onlinepayments/sdk/merchant/mandates/mandates_client.rb', line 20 def initialize(parent, path_context) super(parent: parent, path_context: path_context) end |
Instance Method Details
#block_mandate(unique_mandate_reference, context = nil) ⇒ OnlinePayments::SDK::Domain::GetMandateResponse
Resource /v2/{merchantId}/mandates/{uniqueMandateReference}/block - Block mandate
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/onlinepayments/sdk/merchant/mandates/mandates_client.rb', line 102 def block_mandate(unique_mandate_reference, context = nil) path_context = { 'uniqueMandateReference'.freeze => unique_mandate_reference, } uri = instantiate_uri('/v2/{merchantId}/mandates/{uniqueMandateReference}/block', path_context) @communicator.post( uri, client_headers, nil, nil, OnlinePayments::SDK::Domain::GetMandateResponse, context) rescue OnlinePayments::SDK::Communication::ResponseException => e error_type = OnlinePayments::SDK::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context) end |
#create_mandate(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CreateMandateResponse
Resource /v2/{merchantId}/mandates - Create mandate
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/onlinepayments/sdk/merchant/mandates/mandates_client.rb', line 38 def create_mandate(body, context = nil) uri = instantiate_uri('/v2/{merchantId}/mandates', nil) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::CreateMandateResponse, context) rescue OnlinePayments::SDK::Communication::ResponseException => e error_type = OnlinePayments::SDK::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context) end |
#get_mandate(unique_mandate_reference, context = nil) ⇒ OnlinePayments::SDK::Domain::GetMandateResponse
Resource /v2/{merchantId}/mandates/{uniqueMandateReference} - Get mandate
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/onlinepayments/sdk/merchant/mandates/mandates_client.rb', line 69 def get_mandate(unique_mandate_reference, context = nil) path_context = { 'uniqueMandateReference'.freeze => unique_mandate_reference, } uri = instantiate_uri('/v2/{merchantId}/mandates/{uniqueMandateReference}', path_context) @communicator.get( uri, client_headers, nil, OnlinePayments::SDK::Domain::GetMandateResponse, context) rescue OnlinePayments::SDK::Communication::ResponseException => e error_type = OnlinePayments::SDK::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context) end |
#revoke_mandate(unique_mandate_reference, body, context = nil) ⇒ OnlinePayments::SDK::Domain::GetMandateResponse
Resource /v2/{merchantId}/mandates/{uniqueMandateReference}/revoke - Revoke mandate
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/onlinepayments/sdk/merchant/mandates/mandates_client.rb', line 171 def revoke_mandate(unique_mandate_reference, body, context = nil) path_context = { 'uniqueMandateReference'.freeze => unique_mandate_reference, } uri = instantiate_uri('/v2/{merchantId}/mandates/{uniqueMandateReference}/revoke', path_context) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::GetMandateResponse, context) rescue OnlinePayments::SDK::Communication::ResponseException => e error_type = OnlinePayments::SDK::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context) end |
#unblock_mandate(unique_mandate_reference, context = nil) ⇒ OnlinePayments::SDK::Domain::GetMandateResponse
Resource /v2/{merchantId}/mandates/{uniqueMandateReference}/unblock - Unblock mandate
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/onlinepayments/sdk/merchant/mandates/mandates_client.rb', line 136 def unblock_mandate(unique_mandate_reference, context = nil) path_context = { 'uniqueMandateReference'.freeze => unique_mandate_reference, } uri = instantiate_uri('/v2/{merchantId}/mandates/{uniqueMandateReference}/unblock', path_context) @communicator.post( uri, client_headers, nil, nil, OnlinePayments::SDK::Domain::GetMandateResponse, context) rescue OnlinePayments::SDK::Communication::ResponseException => e error_type = OnlinePayments::SDK::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context) end |