processout 2.19.0 → 2.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +4 -67
- data/.gitignore +0 -52
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/Dockerfile +0 -7
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/Makefile +0 -4
- data/README.md +0 -12
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/processout/activity.rb +0 -206
- data/lib/processout/addon.rb +0 -401
- data/lib/processout/alternative_merchant_certificate.rb +0 -94
- data/lib/processout/api_request.rb +0 -295
- data/lib/processout/api_version.rb +0 -92
- data/lib/processout/apple_pay_alternative_merchant_certificates.rb +0 -110
- data/lib/processout/balance.rb +0 -81
- data/lib/processout/balances.rb +0 -111
- data/lib/processout/card.rb +0 -503
- data/lib/processout/card_information.rb +0 -164
- data/lib/processout/coupon.rb +0 -352
- data/lib/processout/customer.rb +0 -755
- data/lib/processout/customer_action.rb +0 -81
- data/lib/processout/discount.rb +0 -360
- data/lib/processout/dunning_action.rb +0 -81
- data/lib/processout/errors/authentication_error.rb +0 -9
- data/lib/processout/errors/generic_error.rb +0 -9
- data/lib/processout/errors/internal_error.rb +0 -9
- data/lib/processout/errors/notfound_error.rb +0 -9
- data/lib/processout/errors/validation_error.rb +0 -9
- data/lib/processout/event.rb +0 -237
- data/lib/processout/gateway.rb +0 -210
- data/lib/processout/gateway_configuration.rb +0 -346
- data/lib/processout/gateway_request.rb +0 -26
- data/lib/processout/invoice.rb +0 -945
- data/lib/processout/invoice_detail.rb +0 -235
- data/lib/processout/invoice_device.rb +0 -92
- data/lib/processout/invoice_external_fraud_tools.rb +0 -70
- data/lib/processout/invoice_risk.rb +0 -81
- data/lib/processout/invoice_shipping.rb +0 -191
- data/lib/processout/invoice_tax.rb +0 -81
- data/lib/processout/networking/request.rb +0 -102
- data/lib/processout/networking/response.rb +0 -67
- data/lib/processout/payment_data_network_authentication.rb +0 -70
- data/lib/processout/payment_data_three_ds_authentication.rb +0 -70
- data/lib/processout/payment_data_three_ds_request.rb +0 -103
- data/lib/processout/payout.rb +0 -379
- data/lib/processout/payout_item.rb +0 -238
- data/lib/processout/plan.rb +0 -368
- data/lib/processout/product.rb +0 -368
- data/lib/processout/project.rb +0 -353
- data/lib/processout/refund.rb +0 -277
- data/lib/processout/subscription.rb +0 -910
- data/lib/processout/three_ds.rb +0 -158
- data/lib/processout/token.rb +0 -493
- data/lib/processout/transaction.rb +0 -905
- data/lib/processout/transaction_operation.rb +0 -418
- data/lib/processout/version.rb +0 -3
- data/lib/processout/webhook.rb +0 -237
- data/lib/processout/webhook_endpoint.rb +0 -149
- data/lib/processout.rb +0 -263
- data/processout.gemspec +0 -26
data/lib/processout/plan.rb
DELETED
@@ -1,368 +0,0 @@
|
|
1
|
-
# The content of this file was automatically generated
|
2
|
-
|
3
|
-
require "cgi"
|
4
|
-
require "json"
|
5
|
-
require "processout/networking/request"
|
6
|
-
require "processout/networking/response"
|
7
|
-
|
8
|
-
module ProcessOut
|
9
|
-
class Plan
|
10
|
-
|
11
|
-
attr_reader :id
|
12
|
-
attr_reader :project
|
13
|
-
attr_reader :project_id
|
14
|
-
attr_reader :url
|
15
|
-
attr_reader :name
|
16
|
-
attr_reader :amount
|
17
|
-
attr_reader :currency
|
18
|
-
attr_reader :metadata
|
19
|
-
attr_reader :interval
|
20
|
-
attr_reader :trial_period
|
21
|
-
attr_reader :return_url
|
22
|
-
attr_reader :cancel_url
|
23
|
-
attr_reader :sandbox
|
24
|
-
attr_reader :created_at
|
25
|
-
|
26
|
-
|
27
|
-
def id=(val)
|
28
|
-
@id = val
|
29
|
-
end
|
30
|
-
|
31
|
-
def project=(val)
|
32
|
-
if val.nil?
|
33
|
-
@project = val
|
34
|
-
return
|
35
|
-
end
|
36
|
-
|
37
|
-
if val.instance_of? Project
|
38
|
-
@project = val
|
39
|
-
else
|
40
|
-
obj = Project.new(@client)
|
41
|
-
obj.fill_with_data(val)
|
42
|
-
@project = obj
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
def project_id=(val)
|
48
|
-
@project_id = val
|
49
|
-
end
|
50
|
-
|
51
|
-
def url=(val)
|
52
|
-
@url = val
|
53
|
-
end
|
54
|
-
|
55
|
-
def name=(val)
|
56
|
-
@name = val
|
57
|
-
end
|
58
|
-
|
59
|
-
def amount=(val)
|
60
|
-
@amount = val
|
61
|
-
end
|
62
|
-
|
63
|
-
def currency=(val)
|
64
|
-
@currency = val
|
65
|
-
end
|
66
|
-
|
67
|
-
def metadata=(val)
|
68
|
-
@metadata = val
|
69
|
-
end
|
70
|
-
|
71
|
-
def interval=(val)
|
72
|
-
@interval = val
|
73
|
-
end
|
74
|
-
|
75
|
-
def trial_period=(val)
|
76
|
-
@trial_period = val
|
77
|
-
end
|
78
|
-
|
79
|
-
def return_url=(val)
|
80
|
-
@return_url = val
|
81
|
-
end
|
82
|
-
|
83
|
-
def cancel_url=(val)
|
84
|
-
@cancel_url = val
|
85
|
-
end
|
86
|
-
|
87
|
-
def sandbox=(val)
|
88
|
-
@sandbox = val
|
89
|
-
end
|
90
|
-
|
91
|
-
def created_at=(val)
|
92
|
-
@created_at = val
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
# Initializes the Plan object
|
97
|
-
# Params:
|
98
|
-
# +client+:: +ProcessOut+ client instance
|
99
|
-
# +data+:: data that can be used to fill the object
|
100
|
-
def initialize(client, data = {})
|
101
|
-
@client = client
|
102
|
-
|
103
|
-
self.id = data.fetch(:id, nil)
|
104
|
-
self.project = data.fetch(:project, nil)
|
105
|
-
self.project_id = data.fetch(:project_id, nil)
|
106
|
-
self.url = data.fetch(:url, nil)
|
107
|
-
self.name = data.fetch(:name, nil)
|
108
|
-
self.amount = data.fetch(:amount, nil)
|
109
|
-
self.currency = data.fetch(:currency, nil)
|
110
|
-
self.metadata = data.fetch(:metadata, nil)
|
111
|
-
self.interval = data.fetch(:interval, nil)
|
112
|
-
self.trial_period = data.fetch(:trial_period, nil)
|
113
|
-
self.return_url = data.fetch(:return_url, nil)
|
114
|
-
self.cancel_url = data.fetch(:cancel_url, nil)
|
115
|
-
self.sandbox = data.fetch(:sandbox, nil)
|
116
|
-
self.created_at = data.fetch(:created_at, nil)
|
117
|
-
|
118
|
-
end
|
119
|
-
|
120
|
-
# Create a new Plan using the current client
|
121
|
-
def new(data = {})
|
122
|
-
Plan.new(@client, data)
|
123
|
-
end
|
124
|
-
|
125
|
-
# Overrides the JSON marshaller to only send the fields we want
|
126
|
-
def to_json(options)
|
127
|
-
{
|
128
|
-
"id": self.id,
|
129
|
-
"project": self.project,
|
130
|
-
"project_id": self.project_id,
|
131
|
-
"url": self.url,
|
132
|
-
"name": self.name,
|
133
|
-
"amount": self.amount,
|
134
|
-
"currency": self.currency,
|
135
|
-
"metadata": self.metadata,
|
136
|
-
"interval": self.interval,
|
137
|
-
"trial_period": self.trial_period,
|
138
|
-
"return_url": self.return_url,
|
139
|
-
"cancel_url": self.cancel_url,
|
140
|
-
"sandbox": self.sandbox,
|
141
|
-
"created_at": self.created_at,
|
142
|
-
}.to_json
|
143
|
-
end
|
144
|
-
|
145
|
-
# Fills the object with data coming from the API
|
146
|
-
# Params:
|
147
|
-
# +data+:: +Hash+ of data coming from the API
|
148
|
-
def fill_with_data(data)
|
149
|
-
if data.nil?
|
150
|
-
return self
|
151
|
-
end
|
152
|
-
if data.include? "id"
|
153
|
-
self.id = data["id"]
|
154
|
-
end
|
155
|
-
if data.include? "project"
|
156
|
-
self.project = data["project"]
|
157
|
-
end
|
158
|
-
if data.include? "project_id"
|
159
|
-
self.project_id = data["project_id"]
|
160
|
-
end
|
161
|
-
if data.include? "url"
|
162
|
-
self.url = data["url"]
|
163
|
-
end
|
164
|
-
if data.include? "name"
|
165
|
-
self.name = data["name"]
|
166
|
-
end
|
167
|
-
if data.include? "amount"
|
168
|
-
self.amount = data["amount"]
|
169
|
-
end
|
170
|
-
if data.include? "currency"
|
171
|
-
self.currency = data["currency"]
|
172
|
-
end
|
173
|
-
if data.include? "metadata"
|
174
|
-
self.metadata = data["metadata"]
|
175
|
-
end
|
176
|
-
if data.include? "interval"
|
177
|
-
self.interval = data["interval"]
|
178
|
-
end
|
179
|
-
if data.include? "trial_period"
|
180
|
-
self.trial_period = data["trial_period"]
|
181
|
-
end
|
182
|
-
if data.include? "return_url"
|
183
|
-
self.return_url = data["return_url"]
|
184
|
-
end
|
185
|
-
if data.include? "cancel_url"
|
186
|
-
self.cancel_url = data["cancel_url"]
|
187
|
-
end
|
188
|
-
if data.include? "sandbox"
|
189
|
-
self.sandbox = data["sandbox"]
|
190
|
-
end
|
191
|
-
if data.include? "created_at"
|
192
|
-
self.created_at = data["created_at"]
|
193
|
-
end
|
194
|
-
|
195
|
-
self
|
196
|
-
end
|
197
|
-
|
198
|
-
# Prefills the object with the data passed as parameters
|
199
|
-
# Params:
|
200
|
-
# +data+:: +Hash+ of data
|
201
|
-
def prefill(data)
|
202
|
-
if data.nil?
|
203
|
-
return self
|
204
|
-
end
|
205
|
-
self.id = data.fetch(:id, self.id)
|
206
|
-
self.project = data.fetch(:project, self.project)
|
207
|
-
self.project_id = data.fetch(:project_id, self.project_id)
|
208
|
-
self.url = data.fetch(:url, self.url)
|
209
|
-
self.name = data.fetch(:name, self.name)
|
210
|
-
self.amount = data.fetch(:amount, self.amount)
|
211
|
-
self.currency = data.fetch(:currency, self.currency)
|
212
|
-
self.metadata = data.fetch(:metadata, self.metadata)
|
213
|
-
self.interval = data.fetch(:interval, self.interval)
|
214
|
-
self.trial_period = data.fetch(:trial_period, self.trial_period)
|
215
|
-
self.return_url = data.fetch(:return_url, self.return_url)
|
216
|
-
self.cancel_url = data.fetch(:cancel_url, self.cancel_url)
|
217
|
-
self.sandbox = data.fetch(:sandbox, self.sandbox)
|
218
|
-
self.created_at = data.fetch(:created_at, self.created_at)
|
219
|
-
|
220
|
-
self
|
221
|
-
end
|
222
|
-
|
223
|
-
# Get all the plans.
|
224
|
-
# Params:
|
225
|
-
# +options+:: +Hash+ of options
|
226
|
-
def all(options = {})
|
227
|
-
self.prefill(options)
|
228
|
-
|
229
|
-
request = Request.new(@client)
|
230
|
-
path = "/plans"
|
231
|
-
data = {
|
232
|
-
|
233
|
-
}
|
234
|
-
|
235
|
-
response = Response.new(request.get(path, data, options))
|
236
|
-
return_values = Array.new
|
237
|
-
|
238
|
-
a = Array.new
|
239
|
-
body = response.body
|
240
|
-
for v in body['plans']
|
241
|
-
tmp = Plan.new(@client)
|
242
|
-
tmp.fill_with_data(v)
|
243
|
-
a.push(tmp)
|
244
|
-
end
|
245
|
-
|
246
|
-
return_values.push(a)
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
return_values[0]
|
251
|
-
end
|
252
|
-
|
253
|
-
# Create a new plan.
|
254
|
-
# Params:
|
255
|
-
# +options+:: +Hash+ of options
|
256
|
-
def create(options = {})
|
257
|
-
self.prefill(options)
|
258
|
-
|
259
|
-
request = Request.new(@client)
|
260
|
-
path = "/plans"
|
261
|
-
data = {
|
262
|
-
"id" => @id,
|
263
|
-
"name" => @name,
|
264
|
-
"amount" => @amount,
|
265
|
-
"currency" => @currency,
|
266
|
-
"interval" => @interval,
|
267
|
-
"trial_period" => @trial_period,
|
268
|
-
"metadata" => @metadata,
|
269
|
-
"return_url" => @return_url,
|
270
|
-
"cancel_url" => @cancel_url
|
271
|
-
}
|
272
|
-
|
273
|
-
response = Response.new(request.post(path, data, options))
|
274
|
-
return_values = Array.new
|
275
|
-
|
276
|
-
body = response.body
|
277
|
-
body = body["plan"]
|
278
|
-
|
279
|
-
|
280
|
-
return_values.push(self.fill_with_data(body))
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
return_values[0]
|
285
|
-
end
|
286
|
-
|
287
|
-
# Find a plan by its ID.
|
288
|
-
# Params:
|
289
|
-
# +plan_id+:: ID of the plan
|
290
|
-
# +options+:: +Hash+ of options
|
291
|
-
def find(plan_id, options = {})
|
292
|
-
self.prefill(options)
|
293
|
-
|
294
|
-
request = Request.new(@client)
|
295
|
-
path = "/plans/" + CGI.escape(plan_id) + ""
|
296
|
-
data = {
|
297
|
-
|
298
|
-
}
|
299
|
-
|
300
|
-
response = Response.new(request.get(path, data, options))
|
301
|
-
return_values = Array.new
|
302
|
-
|
303
|
-
body = response.body
|
304
|
-
body = body["plan"]
|
305
|
-
|
306
|
-
|
307
|
-
obj = Plan.new(@client)
|
308
|
-
return_values.push(obj.fill_with_data(body))
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
return_values[0]
|
313
|
-
end
|
314
|
-
|
315
|
-
# Save the updated plan attributes. This action won't affect subscriptions already linked to this plan.
|
316
|
-
# Params:
|
317
|
-
# +options+:: +Hash+ of options
|
318
|
-
def save(options = {})
|
319
|
-
self.prefill(options)
|
320
|
-
|
321
|
-
request = Request.new(@client)
|
322
|
-
path = "/plans/" + CGI.escape(@id) + ""
|
323
|
-
data = {
|
324
|
-
"name" => @name,
|
325
|
-
"trial_period" => @trial_period,
|
326
|
-
"metadata" => @metadata,
|
327
|
-
"return_url" => @return_url,
|
328
|
-
"cancel_url" => @cancel_url
|
329
|
-
}
|
330
|
-
|
331
|
-
response = Response.new(request.put(path, data, options))
|
332
|
-
return_values = Array.new
|
333
|
-
|
334
|
-
body = response.body
|
335
|
-
body = body["plan"]
|
336
|
-
|
337
|
-
|
338
|
-
return_values.push(self.fill_with_data(body))
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
return_values[0]
|
343
|
-
end
|
344
|
-
|
345
|
-
# Delete a plan. Subscriptions linked to this plan won't be affected.
|
346
|
-
# Params:
|
347
|
-
# +options+:: +Hash+ of options
|
348
|
-
def end(options = {})
|
349
|
-
self.prefill(options)
|
350
|
-
|
351
|
-
request = Request.new(@client)
|
352
|
-
path = "/plans/" + CGI.escape(@id) + ""
|
353
|
-
data = {
|
354
|
-
|
355
|
-
}
|
356
|
-
|
357
|
-
response = Response.new(request.delete(path, data, options))
|
358
|
-
return_values = Array.new
|
359
|
-
|
360
|
-
return_values.push(response.success)
|
361
|
-
|
362
|
-
|
363
|
-
return_values[0]
|
364
|
-
end
|
365
|
-
|
366
|
-
|
367
|
-
end
|
368
|
-
end
|