Class: Cardgate::Refund
- Inherits:
-
Object
show all
- Defined in:
- lib/cardgate/refund.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(attributes = {}) ⇒ Refund
Returns a new instance of Refund.
7
8
9
10
11
|
# File 'lib/cardgate/refund.rb', line 7
def initialize(attributes = {})
attributes.each do |k,v|
send("#{k}=", v)
end
end
|
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
5
6
7
|
# File 'lib/cardgate/refund.rb', line 5
def amount
@amount
end
|
#reason ⇒ Object
Returns the value of attribute reason.
5
6
7
|
# File 'lib/cardgate/refund.rb', line 5
def reason
@reason
end
|
#referenced_transaction_id ⇒ Object
Returns the value of attribute referenced_transaction_id.
5
6
7
|
# File 'lib/cardgate/refund.rb', line 5
def referenced_transaction_id
@referenced_transaction_id
end
|
#site_id ⇒ Object
Returns the value of attribute site_id.
5
6
7
|
# File 'lib/cardgate/refund.rb', line 5
def site_id
@site_id
end
|
Instance Method Details
#api_refund_endpoint ⇒ Object
42
43
44
|
# File 'lib/cardgate/refund.rb', line 42
def api_refund_endpoint
"/rest/v1/#{provider}/refund/"
end
|
#default_params ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/cardgate/refund.rb', line 13
def default_params
{
refund: {
site_id: @site_id,
referenced_transaction_id: @referenced_transaction_id,
amount: @amount,
reason: @reason
}
}
end
|
#initiate ⇒ Object
32
33
34
35
36
|
# File 'lib/cardgate/refund.rb', line 32
def initiate
@response ||= response
self
end
|
#params ⇒ Object
24
25
26
|
# File 'lib/cardgate/refund.rb', line 24
def params
default_params.deep_merge!(refund_params)
end
|
#refund_params ⇒ Object
28
29
30
|
# File 'lib/cardgate/refund.rb', line 28
def refund_params
{}
end
|
#transaction_id ⇒ Object
38
39
40
|
# File 'lib/cardgate/refund.rb', line 38
def transaction_id
@response.body['refund']['transaction_id']
end
|