Class: Tikkie::Api::Resources::Refund
- Inherits:
-
Base
- Object
- Base
- Tikkie::Api::Resources::Refund
show all
- Defined in:
- lib/tikkie/api/resources/refund.rb
Overview
Constant Summary
collapse
- STATUS_PENDING =
"PENDING"
- STATUS_PAID =
"PAID"
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 = {}) ⇒ Refund
Returns a new instance of Refund.
15
16
17
18
19
20
|
# File 'lib/tikkie/api/resources/refund.rb', line 15
def initialize(config, options = {})
@payment_request_token = options.delete(:payment_request_token)
@payment_token = options.delete(:payment_token)
@refund_token = options.delete(:refund_token)
super(config, options)
end
|
Instance Attribute Details
#payment_request_token ⇒ Object
Returns the value of attribute payment_request_token.
13
14
15
|
# File 'lib/tikkie/api/resources/refund.rb', line 13
def payment_request_token
@payment_request_token
end
|
#payment_token ⇒ Object
Returns the value of attribute payment_token.
13
14
15
|
# File 'lib/tikkie/api/resources/refund.rb', line 13
def payment_token
@payment_token
end
|
Instance Method Details
#amount ⇒ Object
26
27
28
|
# File 'lib/tikkie/api/resources/refund.rb', line 26
def amount
Tikkie::Api::Amount.from_cents(body[:amountInCents]).to_d
end
|
#created_at ⇒ Object
38
39
40
|
# File 'lib/tikkie/api/resources/refund.rb', line 38
def created_at
Time.parse(body[:createdDateTime]) if body[:createdDateTime]
end
|
#description ⇒ Object
30
31
32
|
# File 'lib/tikkie/api/resources/refund.rb', line 30
def description
body[:description]
end
|
#paid? ⇒ Boolean
50
51
52
|
# File 'lib/tikkie/api/resources/refund.rb', line 50
def paid?
status == STATUS_PAID
end
|
#pending? ⇒ Boolean
46
47
48
|
# File 'lib/tikkie/api/resources/refund.rb', line 46
def pending?
status == STATUS_PENDING
end
|
#reference_id ⇒ Object
34
35
36
|
# File 'lib/tikkie/api/resources/refund.rb', line 34
def reference_id
body[:referenceId]
end
|
#refund_token ⇒ Object
22
23
24
|
# File 'lib/tikkie/api/resources/refund.rb', line 22
def refund_token
@refund_token || body[:refundToken]
end
|
#status ⇒ Object
42
43
44
|
# File 'lib/tikkie/api/resources/refund.rb', line 42
def status
body[:status]
end
|