Class: ForestLiana::StripeController
Instance Method Summary
collapse
#authenticate_user_from_jwt, #forest_user, papertrail?, #route_not_found, #serialize_model, #serialize_models
Instance Method Details
#bank_account ⇒ Object
125
126
127
128
129
130
131
132
133
134
135
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 125
def bank_account
getter = StripeSourceGetter.new(params, request.['Stripe-Secret-Key'],
request.['Stripe-Reference'])
getter.perform
render serializer: nil, json: serialize_model(getter.record, {
context: { type: get_serializer_type('stripe_bank_accounts') },
skip_collection_check: true,
include: ['customer']
})
end
|
#bank_accounts ⇒ Object
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 112
def bank_accounts
params[:object] = 'bank_account'
getter = StripeSourcesGetter.new(params, request.['Stripe-Secret-Key'],
request.['Stripe-Reference'])
getter.perform
render serializer: nil, json: serialize_models(getter.records, {
context: { type: get_serializer_type('stripe_bank_accounts') },
count: getter.count,
include: ['customer']
})
end
|
#card ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 52
def card
getter = StripeSourceGetter.new(params, request.['Stripe-Secret-Key'],
request.['Stripe-Reference'])
getter.perform
render serializer: nil, json: serialize_model(getter.record, {
context: { type: get_serializer_type('stripe_cards') },
skip_collection_check: true,
include: ['customer']
})
end
|
#cards ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 39
def cards
params[:object] = 'card'
getter = StripeSourcesGetter.new(params, request.['Stripe-Secret-Key'],
request.['Stripe-Reference'])
getter.perform
render serializer: nil, json: serialize_models(getter.records, {
context: { type: get_serializer_type('stripe_cards') },
count: getter.count,
include: ['customer']
})
end
|
#get_serializer_type(suffix) ⇒ Object
137
138
139
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 137
def get_serializer_type(suffix)
"#{params[:collection]}_#{suffix}"
end
|
#invoice ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 76
def invoice
getter = StripeInvoiceGetter.new(params, request.['Stripe-Secret-Key'],
request.['Stripe-Reference'])
getter.perform
render serializer: nil, json: serialize_model(getter.record, {
context: { type: get_serializer_type('stripe_invoices') },
skip_collection_check: true,
include: ['customer']
})
end
|
#invoices ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 64
def invoices
getter = StripeInvoicesGetter.new(params, request.['Stripe-Secret-Key'],
request.['Stripe-Reference'])
getter.perform
render serializer: nil, json: serialize_models(getter.records, {
context: { type: get_serializer_type('stripe_invoices') },
count: getter.count,
include: ['customer']
})
end
|
#payment ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 16
def payment
getter = StripePaymentGetter.new(params, request.['Stripe-Secret-Key'],
request.['Stripe-Reference'])
getter.perform
render serializer: nil, json: serialize_model(getter.record, {
context: { type: get_serializer_type('stripe_payments') },
skip_collection_check: true,
include: ['customer']
})
end
|
#payments ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 4
def payments
getter = StripePaymentsGetter.new(params, request.['Stripe-Secret-Key'],
request.['Stripe-Reference'])
getter.perform
render serializer: nil, json: serialize_models(getter.records, {
context: { type: get_serializer_type('stripe_payments') },
count: getter.count,
include: ['customer']
})
end
|
#refund ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 28
def refund
begin
refunder = StripePaymentRefunder.new(params)
refunder.perform
render serializer: nil, json: {}
rescue Stripe::InvalidRequestError => err
render serializer: nil, json: { error: err.message }, status: 400
end
end
|
#subscription ⇒ Object
100
101
102
103
104
105
106
107
108
109
110
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 100
def subscription
getter = StripeSubscriptionGetter.new(params, request.['Stripe-Secret-Key'],
request.['Stripe-Reference'])
getter.perform
render serializer: nil, json: serialize_model(getter.record, {
context: { type: get_serializer_type('stripe_subscriptions') },
skip_collection_check: true,
include: ['customer']
})
end
|
#subscriptions ⇒ Object
88
89
90
91
92
93
94
95
96
97
98
|
# File 'app/controllers/forest_liana/stripe_controller.rb', line 88
def subscriptions
getter = StripeSubscriptionsGetter.new(params, request.['Stripe-Secret-Key'],
request.['Stripe-Reference'])
getter.perform
render serializer: nil, json: serialize_models(getter.records, {
context: { type: get_serializer_type('stripe_subscriptions') },
count: getter.count,
include: ['customer']
})
end
|