Class: Payabli::PaymentMethodDomain::Client
- Inherits:
-
Object
- Object
- Payabli::PaymentMethodDomain::Client
- Defined in:
- lib/payabli/payment_method_domain/client.rb
Instance Method Summary collapse
-
#add_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::AddPaymentMethodDomainApiResponse
Add a payment method domain to an organization or paypoint.
-
#cascade_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::PaymentMethodDomainGeneralResponse
Cascades a payment method domain to all child entities.
-
#delete_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::DeletePaymentMethodDomainResponse
Delete a payment method domain.
-
#get_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::PaymentMethodDomainApiResponse
Get the details for a payment method domain.
- #initialize(client:) ⇒ void constructor
-
#list_payment_method_domains(request_options: {}, **params) ⇒ Payabli::Types::ListPaymentMethodDomainsResponse
Get a list of payment method domains that belong to a PSP, organization, or paypoint.
-
#update_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::PaymentMethodDomainGeneralResponse
Update a payment method domain's configuration values.
-
#verify_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::PaymentMethodDomainGeneralResponse
Verify a new payment method domain.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/payabli/payment_method_domain/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#add_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::AddPaymentMethodDomainApiResponse
Add a payment method domain to an organization or paypoint.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/payabli/payment_method_domain/client.rb', line 37 def add_payment_method_domain(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "PaymentMethodDomain", headers: headers, body: Payabli::PaymentMethodDomain::Types::AddPaymentMethodDomainRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Payabli::Types::AddPaymentMethodDomainApiResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#cascade_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::PaymentMethodDomainGeneralResponse
Cascades a payment method domain to all child entities. All paypoints and suborganization under this parent will inherit this domain and its settings.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/payabli/payment_method_domain/client.rb', line 78 def cascade_payment_method_domain(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "PaymentMethodDomain/#{URI.encode_uri_component(params[:domain_id].to_s)}/cascade", headers: headers, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Payabli::Types::PaymentMethodDomainGeneralResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::DeletePaymentMethodDomainResponse
Delete a payment method domain. You can't delete an inherited domain, you must delete a domain at the organization level.
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/payabli/payment_method_domain/client.rb', line 157 def delete_payment_method_domain(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "PaymentMethodDomain/#{URI.encode_uri_component(params[:domain_id].to_s)}", headers: headers, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Payabli::Types::DeletePaymentMethodDomainResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::PaymentMethodDomainApiResponse
Get the details for a payment method domain.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/payabli/payment_method_domain/client.rb', line 117 def get_payment_method_domain(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "PaymentMethodDomain/#{URI.encode_uri_component(params[:domain_id].to_s)}", headers: headers, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Payabli::Types::PaymentMethodDomainApiResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_payment_method_domains(request_options: {}, **params) ⇒ Payabli::Types::ListPaymentMethodDomainsResponse
Get a list of payment method domains that belong to a PSP, organization, or paypoint.
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/payabli/payment_method_domain/client.rb', line 254 def list_payment_method_domains(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["entityId"] = params[:entity_id] if params.key?(:entity_id) query_params["entityType"] = params[:entity_type] if params.key?(:entity_type) query_params["fromRecord"] = params[:from_record] if params.key?(:from_record) query_params["limitRecord"] = params[:limit_record] if params.key?(:limit_record) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "PaymentMethodDomain/list", headers: headers, query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Payabli::Types::ListPaymentMethodDomainsResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::PaymentMethodDomainGeneralResponse
Update a payment method domain's configuration values.
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/payabli/payment_method_domain/client.rb', line 204 def update_payment_method_domain(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) request_data = Payabli::PaymentMethodDomain::Types::UpdatePaymentMethodDomainRequest.new(params).to_h non_body_param_names = %w[domainId] body = request_data.except(*non_body_param_names) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "PATCH", path: "PaymentMethodDomain/#{URI.encode_uri_component(params[:domain_id].to_s)}", headers: headers, body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Payabli::Types::PaymentMethodDomainGeneralResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#verify_payment_method_domain(request_options: {}, **params) ⇒ Payabli::Types::PaymentMethodDomainGeneralResponse
Verify a new payment method domain. If verification is successful, Apple Pay is automatically activated for the domain.
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/payabli/payment_method_domain/client.rb', line 301 def verify_payment_method_domain(request_options: {}, **params) params = Payabli::Internal::Types::Utils.normalize_keys(params) headers = @client.auth_headers_for_endpoint(security: [{ "BearerAuth" => [] }, { "APIKeyAuth" => [] }]) request = Payabli::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "PaymentMethodDomain/#{URI.encode_uri_component(params[:domain_id].to_s)}/verify", headers: headers, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Payabli::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Payabli::Types::PaymentMethodDomainGeneralResponse.load(response.body) else error_class = Payabli::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |