Class: Kount::Response

Inherits:
AbstractResponse show all
Defined in:
lib/kount/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Response



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kount/response.rb', line 9

def initialize(data)
  @data = data

  if (order = @data["order"])
    @order_id           = order["order_id"]
    @merchant_order_id  = order["merchant_order_id"]
    @channel            = order["channel"]
    @device_session_id  = order["device_session_id"]
    @creation_date_time = order["creation_date_time"]
    @risk_inquiry       = RiskInquiry.new(order["risk_inquiry"] || {})
    @transactions       = (order["transactions"] || []).map { |t| Transaction.new(t) }
  else
    @data
  end
end

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



5
6
7
# File 'lib/kount/response.rb', line 5

def channel
  @channel
end

#creation_date_timeObject

Returns the value of attribute creation_date_time.



5
6
7
# File 'lib/kount/response.rb', line 5

def creation_date_time
  @creation_date_time
end

#device_session_idObject

Returns the value of attribute device_session_id.



5
6
7
# File 'lib/kount/response.rb', line 5

def device_session_id
  @device_session_id
end

#fulfillmentObject

Returns the value of attribute fulfillment.



5
6
7
# File 'lib/kount/response.rb', line 5

def fulfillment
  @fulfillment
end

#merchant_order_idObject

Returns the value of attribute merchant_order_id.



5
6
7
# File 'lib/kount/response.rb', line 5

def merchant_order_id
  @merchant_order_id
end

#order_idObject

Returns the value of attribute order_id.



5
6
7
# File 'lib/kount/response.rb', line 5

def order_id
  @order_id
end

#risk_inquiryObject

Returns the value of attribute risk_inquiry.



5
6
7
# File 'lib/kount/response.rb', line 5

def risk_inquiry
  @risk_inquiry
end

#transactionsObject

Returns the value of attribute transactions.



5
6
7
# File 'lib/kount/response.rb', line 5

def transactions
  @transactions
end

Instance Method Details

#approved?Boolean



33
34
35
# File 'lib/kount/response.rb', line 33

def approved?
  !!@risk_inquiry&.approved?
end

#ok?Boolean



29
30
31
# File 'lib/kount/response.rb', line 29

def ok?
  true
end

#to_hashObject



25
26
27
# File 'lib/kount/response.rb', line 25

def to_hash
  @data
end