Class: Tikkie::Api::Resources::Payment
- Inherits:
-
Base
- Object
- Base
- Tikkie::Api::Resources::Payment
show all
- Defined in:
- lib/tikkie/api/resources/payment.rb
Overview
Instance Attribute Summary collapse
Attributes inherited from Base
#config, #options
Instance Method Summary
collapse
Methods inherited from Base
#delete, #load, #loaded?, #save
Constructor Details
#initialize(config, options = {}) ⇒ Payment
Returns a new instance of Payment.
12
13
14
15
16
|
# File 'lib/tikkie/api/resources/payment.rb', line 12
def initialize(config, options = {})
@payment_request_token = options.delete(:payment_request_token)
@payment_token = options.delete(:payment_token)
super(config, options)
end
|
Instance Attribute Details
#payment_request_token ⇒ Object
Returns the value of attribute payment_request_token.
10
11
12
|
# File 'lib/tikkie/api/resources/payment.rb', line 10
def payment_request_token
@payment_request_token
end
|
Instance Method Details
#amount ⇒ Object
34
35
36
|
# File 'lib/tikkie/api/resources/payment.rb', line 34
def amount
Tikkie::Api::Amount.from_cents(body[:amountInCents]).to_d
end
|
#counter_party_account_number ⇒ Object
30
31
32
|
# File 'lib/tikkie/api/resources/payment.rb', line 30
def counter_party_account_number
body[:counterPartyAccountNumber]
end
|
#counter_party_name ⇒ Object
26
27
28
|
# File 'lib/tikkie/api/resources/payment.rb', line 26
def counter_party_name
body[:counterPartyName]
end
|
#created_at ⇒ Object
42
43
44
|
# File 'lib/tikkie/api/resources/payment.rb', line 42
def created_at
Time.parse(body[:createdDateTime]) if body[:createdDateTime]
end
|
#description ⇒ Object
38
39
40
|
# File 'lib/tikkie/api/resources/payment.rb', line 38
def description
body[:description]
end
|
#payment_token ⇒ Object
18
19
20
|
# File 'lib/tikkie/api/resources/payment.rb', line 18
def payment_token
@payment_token || body[:paymentToken]
end
|
#refunds ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/tikkie/api/resources/payment.rb', line 46
def refunds
@refunds ||= begin
refunds = []
if body[:refunds]
body[:refunds].each do |refund|
refunds << Tikkie::Api::Resources::Refund.new(config, body: refund)
end
end
refunds
end
end
|
#tikkie_id ⇒ Object
22
23
24
|
# File 'lib/tikkie/api/resources/payment.rb', line 22
def tikkie_id
body[:tikkieId]
end
|