Class: OrbipayPaymentsapiClient::OrbipayPaymentsapiClientHandlers::CreateCustomerHandler
- Inherits:
-
Base
- Object
- Base
- OrbipayPaymentsapiClient::OrbipayPaymentsapiClientHandlers::CreateCustomerHandler
- Defined in:
- lib/orbipay_paymentsapi_client/handlers/create_customer_handler.rb
Overview
.
############################################################################################
## This class subject to change without prior notice, Please dont use this class directly.##
############################################################################################
Instance Attribute Summary
Attributes inherited from Base
#api_end_point, #http_status_code, #invocation_context, #live_mode
Instance Method Summary collapse
- #populate_request_body(customer) ⇒ Object
- #process(customer) ⇒ Object
- #wrap_response_body(customer_response) ⇒ Object
- #wrap_response_headers(headers) ⇒ Object
Methods inherited from Base
attribute_map, #for_client, #initialize, #requested_by, #set_api_end_point, #set_values, swagger_types, #vide_channel, #with_context
Constructor Details
This class inherits a constructor from OrbipayPaymentsapiClient::Base
Instance Method Details
#populate_request_body(customer) ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/orbipay_paymentsapi_client/handlers/create_customer_handler.rb', line 59 def populate_request_body(customer) customer_json_object = CommonUtil::CommonUtil.object_to_http_body(customer) create_customer_request = CommonUtil::CommonUtil.deserialize(customer_json_object,"CreateCustomerRequest") if !customer.customer_accounts.nil? and !customer.customer_accounts.list.nil? json_object = CommonUtil::CommonUtil.object_to_http_body(customer.customer_accounts.list) create_customer_request.set_values(customer_accounts: CommonUtil::CommonUtil.deserialize(json_object, 'Array<CreateCustomerAccountRequest>')) end create_customer_request end |
#process(customer) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/orbipay_paymentsapi_client/handlers/create_customer_handler.rb', line 13 def process(customer) configuration = Configuration::Configuration.new if customer.invocation_context.secret != nil configuration.set_values(secret: customer.invocation_context.secret) end if customer.invocation_context.api_key != nil configuration.set_values(client_api_key: customer.invocation_context.api_key) end if customer.invocation_context.auth_scheme != nil configuration.set_values(algorithm: customer.invocation_context.auth_scheme) end configuration.set_values(api_end_point: customer.api_end_point) if customer.invocation_context.idempotent_request_key != nil configuration.logger.info "Idempotent Request Key: #{ customer.invocation_context.idempotent_request_key}" end api_client = ApiClient::ApiClient.new(configuration) api_instance = OrbipayPaymentsapiClientApis::CustomerApi.new(api_client) channel = customer.invocation_context.channel client_key = customer.invocation_context.client_key product = customer.invocation_context.product if customer.invocation_context. != nil = customer.invocation_context. else = CommonUtil::CommonUtil.time_stamp end idempotent_request_key = customer.invocation_context.idempotent_request_key requestor_type = customer.invocation_context.requestor_type create_customer_request = self.populate_request_body(customer) requestor = customer.invocation_context.requestor x_opay_headers = customer.invocation_context.x_opay_headers opts = { requestor: requestor, x_opay_headers: x_opay_headers, } data, http_status_code, headers = api_instance.create_customer(channel, client_key, product, , idempotent_request_key, requestor_type, create_customer_request, opts) response = wrap_response_body(data) if response == nil response = Customer.new end response.set_values(invocation_context: wrap_response_headers(headers)) response.set_values(http_status_code: http_status_code) response end |
#wrap_response_body(customer_response) ⇒ Object
69 70 71 72 |
# File 'lib/orbipay_paymentsapi_client/handlers/create_customer_handler.rb', line 69 def wrap_response_body(customer_response) customer_json_object = CommonUtil::CommonUtil.object_to_http_body(customer_response) CommonUtil::CommonUtil.deserialize(customer_json_object,"Customer") end |
#wrap_response_headers(headers) ⇒ Object
74 75 76 77 |
# File 'lib/orbipay_paymentsapi_client/handlers/create_customer_handler.rb', line 74 def wrap_response_headers(headers) headers_json_object = CommonUtil::CommonUtil.object_to_http_body(headers) CommonUtil::CommonUtil.deserialize(headers_json_object,"InvocationContext") end |