Class: OrbipayPaymentsapiClient::OrbipayPaymentsapiClientHandlers::RetrieveRefundsHandler

Inherits:
Base
  • Object
show all
Defined in:
lib/orbipay_paymentsapi_client/handlers/retrieve_refunds_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

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

#process(refunds) ⇒ Object

[View source]

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/orbipay_paymentsapi_client/handlers/retrieve_refunds_handler.rb', line 13

def process(refunds)

	configuration = Configuration::Configuration.new
	if refunds.invocation_context.secret != nil
		configuration.set_values(secret: refunds.invocation_context.secret)
	end
	if refunds.invocation_context.api_key != nil
		configuration.set_values(client_api_key: refunds.invocation_context.api_key)
	end
	if refunds.invocation_context.auth_scheme != nil
		configuration.set_values(algorithm: refunds.invocation_context.auth_scheme)
	end
	configuration.set_values(api_end_point: refunds.api_end_point)
	if refunds.invocation_context.idempotent_request_key != nil 
		configuration.logger.info "Idempotent Request Key: #{ refunds.invocation_context.idempotent_request_key}"
	end
		api_client = ApiClient::ApiClient.new(configuration)
		api_instance = OrbipayPaymentsapiClientApis::RefundApi.new(api_client)
		channel = refunds.invocation_context.channel
		client_key = refunds.invocation_context.client_key
		product = refunds.invocation_context.product
		if refunds.invocation_context.timestamp != nil 
			timestamp = refunds.invocation_context.timestamp
		else
			timestamp = CommonUtil::CommonUtil.time_stamp
		end
		idempotent_request_key = refunds.invocation_context.idempotent_request_key
		requestor_type = refunds.invocation_context.requestor_type
		requestor = refunds.invocation_context.requestor
		x_opay_headers = refunds.invocation_context.x_opay_headers
		trace_id = refunds.invocation_context.trace_id
		id_customer = refunds.id_customer
		confirmation_number = refunds.confirmation_number
		status = refunds.status
		from_date = refunds.from_date
		to_date = refunds.to_date
		page_size = refunds.page_size
		query_id = refunds.query_id
		from_index = refunds.from_index
		to_index = refunds.to_index
		opts = {
		requestor: requestor,
		x_opay_headers: x_opay_headers,
		trace_id: trace_id,
		id_customer: id_customer,
		confirmation_number: confirmation_number,
		status: status,
		from_date: from_date,
		to_date: to_date,
		page_size: page_size,
		query_id: query_id,
		from_index: from_index,
		to_index: to_index,
		}
		data, http_status_code, headers = api_instance.retrieve_refunds(channel, client_key, product, timestamp, idempotent_request_key, requestor_type,  opts)
		response = wrap_response_body(data)
		if response == nil
			response = Refunds.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(refunds_response) ⇒ Object

[View source]

78
79
80
81
# File 'lib/orbipay_paymentsapi_client/handlers/retrieve_refunds_handler.rb', line 78

def wrap_response_body(refunds_response)
   	refunds_json_object = CommonUtil::CommonUtil.object_to_http_body(refunds_response)
   	CommonUtil::CommonUtil.deserialize(refunds_json_object,"Refunds")
end

#wrap_response_headers(headers) ⇒ Object

[View source]

83
84
85
86
# File 'lib/orbipay_paymentsapi_client/handlers/retrieve_refunds_handler.rb', line 83

def wrap_response_headers(headers)
	headers_json_object = CommonUtil::CommonUtil.object_to_http_body(headers)
	CommonUtil::CommonUtil.deserialize(headers_json_object,"InvocationContext")
end