Class: Stripe::Charge
Constant Summary
collapse
- OBJECT_NAME =
"charge".freeze
Instance Attribute Summary
Attributes inherited from APIResource
#save_with_parent
Instance Method Summary
collapse
create
list
included, #save
Methods inherited from APIResource
class_name, custom_method, #refresh, resource_url, #resource_url, retrieve, save_nested_resource
included
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #refresh_from, serialize_params, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Stripe::StripeObject
Instance Method Details
#capture(params = {}, opts = {}) ⇒ Object
34
35
36
37
|
# File 'lib/stripe/resources/charge.rb', line 34
def capture(params = {}, opts = {})
resp, opts = request(:post, capture_url, params, opts)
initialize_from(resp.data, opts)
end
|
#close_dispute(params = {}, opts = {}) ⇒ Object
45
46
47
48
|
# File 'lib/stripe/resources/charge.rb', line 45
def close_dispute(params = {}, opts = {})
resp, opts = request(:post, close_dispute_url, params, opts)
initialize_from(resp.data, opts)
end
|
#mark_as_fraudulent ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/stripe/resources/charge.rb', line 50
def mark_as_fraudulent
params = {
fraud_details: { user_report: "fraudulent" },
}
resp, opts = request(:post, resource_url, params)
initialize_from(resp.data, opts)
end
|
#mark_as_safe ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/stripe/resources/charge.rb', line 58
def mark_as_safe
params = {
fraud_details: { user_report: "safe" },
}
resp, opts = request(:post, resource_url, params)
initialize_from(resp.data, opts)
end
|
#refund(params = {}, opts = {}) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/stripe/resources/charge.rb', line 13
def refund(params = {}, opts = {})
if refunds.is_a?(Array)
resp, opts = request(:post, refund_url, params, opts)
initialize_from(resp.data, opts)
else
refunds.create(params, opts)
refresh
end
end
|
#update_dispute(params = {}, opts = {}) ⇒ Object
39
40
41
42
43
|
# File 'lib/stripe/resources/charge.rb', line 39
def update_dispute(params = {}, opts = {})
resp, opts = request(:post, dispute_url, params, opts)
initialize_from({ dispute: resp.data }, opts, true)
dispute
end
|