Class: Fnsapi::KktService
Instance Method Summary
collapse
Methods included from KktConcern
#auth_params, #refresh_credentials!, #uri
Methods inherited from BaseService
#client
Instance Method Details
#check_data(object, user_id = 'default_user') ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/fnsapi/kkt_service.rb', line 7
def check_data(object, user_id = 'default_user')
ticket = Ticket.new(object)
result = client(auth_params(user_id)).call(:send_message, message: check_ticket_hash(ticket))
message_id = result.body.dig(:send_message_response, :message_id)
message = parse_message(message_id, user_id)
return unless message
code = message.dig(:check_ticket_response, :result, :code)
code == '200'
end
|
#get_data(object, user_id = 'default_user') ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/fnsapi/kkt_service.rb', line 19
def get_data(object, user_id = 'default_user')
ticket = Ticket.new(object)
result = client(auth_params(user_id)).call(:send_message, message: get_ticket_hash(ticket))
message_id = result.body.dig(:send_message_response, :message_id)
message = parse_message(message_id, user_id)
return unless message
code = message.dig(:get_ticket_response, :result, :code)
return code if code != '200'
JSON.parse(message.dig(:get_ticket_response, :result, :ticket))
end
|