Class: Tikkie::Api::V1::Responses::Payment

Inherits:
Base
  • Object
show all
Defined in:
lib/tikkie/api/v1/responses/payment.rb

Overview

Payment that is associated with a payment request.

Instance Attribute Summary

Attributes inherited from Base

#data, #response

Instance Method Summary collapse

Methods inherited from Base

#error?, #errors, #initialize, #response_code, #success?, #trace_id

Constructor Details

This class inherits a constructor from Tikkie::Api::V1::Responses::Base

Instance Method Details

#amountObject



20
21
22
23
24
# File 'lib/tikkie/api/v1/responses/payment.rb', line 20

def amount
  decimal = BigDecimal(data[:amountInCents])
  decimal /= 100.0
  decimal
end

#counter_party_nameObject



16
17
18
# File 'lib/tikkie/api/v1/responses/payment.rb', line 16

def counter_party_name
  data[:counterPartyName]
end

#created_atObject



34
35
36
# File 'lib/tikkie/api/v1/responses/payment.rb', line 34

def created_at
  Time.parse(data[:created]) if data[:created]
end

#currencyObject



26
27
28
# File 'lib/tikkie/api/v1/responses/payment.rb', line 26

def currency
  data[:amountCurrency]
end

#descriptionObject



30
31
32
# File 'lib/tikkie/api/v1/responses/payment.rb', line 30

def description
  data[:description]
end

#online_payment_statusObject

See PaymentStatus



39
40
41
# File 'lib/tikkie/api/v1/responses/payment.rb', line 39

def online_payment_status
  data[:onlinePaymentStatus]
end

#paid?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/tikkie/api/v1/responses/payment.rb', line 43

def paid?
  online_payment_status == Tikkie::Api::V1::Types::PaymentStatus::PAID
end

#payment_tokenObject



12
13
14
# File 'lib/tikkie/api/v1/responses/payment.rb', line 12

def payment_token
  data[:paymentToken]
end