processout 3.4.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yaml +1 -1
  3. data/lib/processout/alternative_merchant_certificate.rb +5 -3
  4. data/lib/processout/apm_payment_processing_configuration.rb +81 -0
  5. data/lib/processout/apple_pay_alternative_merchant_certificates.rb +5 -3
  6. data/lib/processout/balances.rb +5 -3
  7. data/lib/processout/card.rb +45 -1
  8. data/lib/processout/card_contact.rb +11 -0
  9. data/lib/processout/card_create_request.rb +38 -2
  10. data/lib/processout/card_information.rb +1 -1
  11. data/lib/processout/card_scheme_details.rb +81 -0
  12. data/lib/processout/card_update_request.rb +37 -2
  13. data/lib/processout/customer.rb +8 -63
  14. data/lib/processout/device.rb +22 -0
  15. data/lib/processout/event.rb +1 -1
  16. data/lib/processout/export_layout.rb +4 -4
  17. data/lib/processout/export_layout_configuration_options.rb +1 -1
  18. data/lib/processout/gateway_configuration.rb +3 -3
  19. data/lib/processout/invoice.rb +163 -80
  20. data/lib/processout/invoice_device.rb +11 -0
  21. data/lib/processout/invoice_external_fraud_tools.rb +12 -0
  22. data/lib/processout/networking/request.rb +1 -1
  23. data/lib/processout/payment_processing_configuration.rb +93 -0
  24. data/lib/processout/payout.rb +1 -1
  25. data/lib/processout/product.rb +8 -6
  26. data/lib/processout/project.rb +2 -63
  27. data/lib/processout/project_sftp_settings_public.rb +1 -1
  28. data/lib/processout/refund.rb +1 -1
  29. data/lib/processout/submerchant.rb +92 -0
  30. data/lib/processout/submerchant_mapping.rb +103 -0
  31. data/lib/processout/token.rb +22 -7
  32. data/lib/processout/transaction.rb +17 -38
  33. data/lib/processout/transaction_operation.rb +11 -0
  34. data/lib/processout/unsupported_feature_bypass.rb +11 -0
  35. data/lib/processout/version.rb +1 -1
  36. data/lib/processout.rb +40 -46
  37. metadata +12 -13
  38. data/lib/processout/activity.rb +0 -206
  39. data/lib/processout/addon.rb +0 -401
  40. data/lib/processout/coupon.rb +0 -352
  41. data/lib/processout/discount.rb +0 -360
  42. data/lib/processout/plan.rb +0 -368
  43. data/lib/processout/subscription.rb +0 -910
@@ -1,352 +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 Coupon
10
-
11
- attr_reader :id
12
- attr_reader :project
13
- attr_reader :project_id
14
- attr_reader :amount_off
15
- attr_reader :percent_off
16
- attr_reader :currency
17
- attr_reader :iteration_count
18
- attr_reader :max_redemptions
19
- attr_reader :expires_at
20
- attr_reader :metadata
21
- attr_reader :redeemed_number
22
- attr_reader :sandbox
23
- attr_reader :created_at
24
-
25
-
26
- def id=(val)
27
- @id = val
28
- end
29
-
30
- def project=(val)
31
- if val.nil?
32
- @project = val
33
- return
34
- end
35
-
36
- if val.instance_of? Project
37
- @project = val
38
- else
39
- obj = Project.new(@client)
40
- obj.fill_with_data(val)
41
- @project = obj
42
- end
43
-
44
- end
45
-
46
- def project_id=(val)
47
- @project_id = val
48
- end
49
-
50
- def amount_off=(val)
51
- @amount_off = val
52
- end
53
-
54
- def percent_off=(val)
55
- @percent_off = val
56
- end
57
-
58
- def currency=(val)
59
- @currency = val
60
- end
61
-
62
- def iteration_count=(val)
63
- @iteration_count = val
64
- end
65
-
66
- def max_redemptions=(val)
67
- @max_redemptions = val
68
- end
69
-
70
- def expires_at=(val)
71
- @expires_at = val
72
- end
73
-
74
- def metadata=(val)
75
- @metadata = val
76
- end
77
-
78
- def redeemed_number=(val)
79
- @redeemed_number = val
80
- end
81
-
82
- def sandbox=(val)
83
- @sandbox = val
84
- end
85
-
86
- def created_at=(val)
87
- @created_at = val
88
- end
89
-
90
-
91
- # Initializes the Coupon object
92
- # Params:
93
- # +client+:: +ProcessOut+ client instance
94
- # +data+:: data that can be used to fill the object
95
- def initialize(client, data = {})
96
- @client = client
97
-
98
- self.id = data.fetch(:id, nil)
99
- self.project = data.fetch(:project, nil)
100
- self.project_id = data.fetch(:project_id, nil)
101
- self.amount_off = data.fetch(:amount_off, nil)
102
- self.percent_off = data.fetch(:percent_off, nil)
103
- self.currency = data.fetch(:currency, nil)
104
- self.iteration_count = data.fetch(:iteration_count, nil)
105
- self.max_redemptions = data.fetch(:max_redemptions, nil)
106
- self.expires_at = data.fetch(:expires_at, nil)
107
- self.metadata = data.fetch(:metadata, nil)
108
- self.redeemed_number = data.fetch(:redeemed_number, nil)
109
- self.sandbox = data.fetch(:sandbox, nil)
110
- self.created_at = data.fetch(:created_at, nil)
111
-
112
- end
113
-
114
- # Create a new Coupon using the current client
115
- def new(data = {})
116
- Coupon.new(@client, data)
117
- end
118
-
119
- # Overrides the JSON marshaller to only send the fields we want
120
- def to_json(options)
121
- {
122
- "id": self.id,
123
- "project": self.project,
124
- "project_id": self.project_id,
125
- "amount_off": self.amount_off,
126
- "percent_off": self.percent_off,
127
- "currency": self.currency,
128
- "iteration_count": self.iteration_count,
129
- "max_redemptions": self.max_redemptions,
130
- "expires_at": self.expires_at,
131
- "metadata": self.metadata,
132
- "redeemed_number": self.redeemed_number,
133
- "sandbox": self.sandbox,
134
- "created_at": self.created_at,
135
- }.to_json
136
- end
137
-
138
- # Fills the object with data coming from the API
139
- # Params:
140
- # +data+:: +Hash+ of data coming from the API
141
- def fill_with_data(data)
142
- if data.nil?
143
- return self
144
- end
145
- if data.include? "id"
146
- self.id = data["id"]
147
- end
148
- if data.include? "project"
149
- self.project = data["project"]
150
- end
151
- if data.include? "project_id"
152
- self.project_id = data["project_id"]
153
- end
154
- if data.include? "amount_off"
155
- self.amount_off = data["amount_off"]
156
- end
157
- if data.include? "percent_off"
158
- self.percent_off = data["percent_off"]
159
- end
160
- if data.include? "currency"
161
- self.currency = data["currency"]
162
- end
163
- if data.include? "iteration_count"
164
- self.iteration_count = data["iteration_count"]
165
- end
166
- if data.include? "max_redemptions"
167
- self.max_redemptions = data["max_redemptions"]
168
- end
169
- if data.include? "expires_at"
170
- self.expires_at = data["expires_at"]
171
- end
172
- if data.include? "metadata"
173
- self.metadata = data["metadata"]
174
- end
175
- if data.include? "redeemed_number"
176
- self.redeemed_number = data["redeemed_number"]
177
- end
178
- if data.include? "sandbox"
179
- self.sandbox = data["sandbox"]
180
- end
181
- if data.include? "created_at"
182
- self.created_at = data["created_at"]
183
- end
184
-
185
- self
186
- end
187
-
188
- # Prefills the object with the data passed as parameters
189
- # Params:
190
- # +data+:: +Hash+ of data
191
- def prefill(data)
192
- if data.nil?
193
- return self
194
- end
195
- self.id = data.fetch(:id, self.id)
196
- self.project = data.fetch(:project, self.project)
197
- self.project_id = data.fetch(:project_id, self.project_id)
198
- self.amount_off = data.fetch(:amount_off, self.amount_off)
199
- self.percent_off = data.fetch(:percent_off, self.percent_off)
200
- self.currency = data.fetch(:currency, self.currency)
201
- self.iteration_count = data.fetch(:iteration_count, self.iteration_count)
202
- self.max_redemptions = data.fetch(:max_redemptions, self.max_redemptions)
203
- self.expires_at = data.fetch(:expires_at, self.expires_at)
204
- self.metadata = data.fetch(:metadata, self.metadata)
205
- self.redeemed_number = data.fetch(:redeemed_number, self.redeemed_number)
206
- self.sandbox = data.fetch(:sandbox, self.sandbox)
207
- self.created_at = data.fetch(:created_at, self.created_at)
208
-
209
- self
210
- end
211
-
212
- # Get all the coupons.
213
- # Params:
214
- # +options+:: +Hash+ of options
215
- def all(options = {})
216
- self.prefill(options)
217
-
218
- request = Request.new(@client)
219
- path = "/coupons"
220
- data = {
221
-
222
- }
223
-
224
- response = Response.new(request.get(path, data, options))
225
- return_values = Array.new
226
-
227
- a = Array.new
228
- body = response.body
229
- for v in body['coupons']
230
- tmp = Coupon.new(@client)
231
- tmp.fill_with_data(v)
232
- a.push(tmp)
233
- end
234
-
235
- return_values.push(a)
236
-
237
-
238
-
239
- return_values[0]
240
- end
241
-
242
- # Create a new coupon.
243
- # Params:
244
- # +options+:: +Hash+ of options
245
- def create(options = {})
246
- self.prefill(options)
247
-
248
- request = Request.new(@client)
249
- path = "/coupons"
250
- data = {
251
- "id" => @id,
252
- "amount_off" => @amount_off,
253
- "percent_off" => @percent_off,
254
- "currency" => @currency,
255
- "iteration_count" => @iteration_count,
256
- "max_redemptions" => @max_redemptions,
257
- "expires_at" => @expires_at,
258
- "metadata" => @metadata
259
- }
260
-
261
- response = Response.new(request.post(path, data, options))
262
- return_values = Array.new
263
-
264
- body = response.body
265
- body = body["coupon"]
266
-
267
-
268
- return_values.push(self.fill_with_data(body))
269
-
270
-
271
-
272
- return_values[0]
273
- end
274
-
275
- # Find a coupon by its ID.
276
- # Params:
277
- # +coupon_id+:: ID of the coupon
278
- # +options+:: +Hash+ of options
279
- def find(coupon_id, options = {})
280
- self.prefill(options)
281
-
282
- request = Request.new(@client)
283
- path = "/coupons/" + CGI.escape(coupon_id) + ""
284
- data = {
285
-
286
- }
287
-
288
- response = Response.new(request.get(path, data, options))
289
- return_values = Array.new
290
-
291
- body = response.body
292
- body = body["coupon"]
293
-
294
-
295
- obj = Coupon.new(@client)
296
- return_values.push(obj.fill_with_data(body))
297
-
298
-
299
-
300
- return_values[0]
301
- end
302
-
303
- # Save the updated coupon attributes.
304
- # Params:
305
- # +options+:: +Hash+ of options
306
- def save(options = {})
307
- self.prefill(options)
308
-
309
- request = Request.new(@client)
310
- path = "/coupons/" + CGI.escape(@id) + ""
311
- data = {
312
- "metadata" => @metadata
313
- }
314
-
315
- response = Response.new(request.put(path, data, options))
316
- return_values = Array.new
317
-
318
- body = response.body
319
- body = body["coupon"]
320
-
321
-
322
- return_values.push(self.fill_with_data(body))
323
-
324
-
325
-
326
- return_values[0]
327
- end
328
-
329
- # Delete the coupon.
330
- # Params:
331
- # +options+:: +Hash+ of options
332
- def delete(options = {})
333
- self.prefill(options)
334
-
335
- request = Request.new(@client)
336
- path = "/coupons/" + CGI.escape(@id) + ""
337
- data = {
338
-
339
- }
340
-
341
- response = Response.new(request.delete(path, data, options))
342
- return_values = Array.new
343
-
344
- return_values.push(response.success)
345
-
346
-
347
- return_values[0]
348
- end
349
-
350
-
351
- end
352
- end
@@ -1,360 +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 Discount
10
-
11
- attr_reader :id
12
- attr_reader :project
13
- attr_reader :project_id
14
- attr_reader :subscription
15
- attr_reader :subscription_id
16
- attr_reader :coupon
17
- attr_reader :coupon_id
18
- attr_reader :name
19
- attr_reader :amount
20
- attr_reader :percent
21
- attr_reader :expires_at
22
- attr_reader :metadata
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 subscription=(val)
52
- if val.nil?
53
- @subscription = val
54
- return
55
- end
56
-
57
- if val.instance_of? Subscription
58
- @subscription = val
59
- else
60
- obj = Subscription.new(@client)
61
- obj.fill_with_data(val)
62
- @subscription = obj
63
- end
64
-
65
- end
66
-
67
- def subscription_id=(val)
68
- @subscription_id = val
69
- end
70
-
71
- def coupon=(val)
72
- if val.nil?
73
- @coupon = val
74
- return
75
- end
76
-
77
- if val.instance_of? Coupon
78
- @coupon = val
79
- else
80
- obj = Coupon.new(@client)
81
- obj.fill_with_data(val)
82
- @coupon = obj
83
- end
84
-
85
- end
86
-
87
- def coupon_id=(val)
88
- @coupon_id = val
89
- end
90
-
91
- def name=(val)
92
- @name = val
93
- end
94
-
95
- def amount=(val)
96
- @amount = val
97
- end
98
-
99
- def percent=(val)
100
- @percent = val
101
- end
102
-
103
- def expires_at=(val)
104
- @expires_at = val
105
- end
106
-
107
- def metadata=(val)
108
- @metadata = val
109
- end
110
-
111
- def sandbox=(val)
112
- @sandbox = val
113
- end
114
-
115
- def created_at=(val)
116
- @created_at = val
117
- end
118
-
119
-
120
- # Initializes the Discount object
121
- # Params:
122
- # +client+:: +ProcessOut+ client instance
123
- # +data+:: data that can be used to fill the object
124
- def initialize(client, data = {})
125
- @client = client
126
-
127
- self.id = data.fetch(:id, nil)
128
- self.project = data.fetch(:project, nil)
129
- self.project_id = data.fetch(:project_id, nil)
130
- self.subscription = data.fetch(:subscription, nil)
131
- self.subscription_id = data.fetch(:subscription_id, nil)
132
- self.coupon = data.fetch(:coupon, nil)
133
- self.coupon_id = data.fetch(:coupon_id, nil)
134
- self.name = data.fetch(:name, nil)
135
- self.amount = data.fetch(:amount, nil)
136
- self.percent = data.fetch(:percent, nil)
137
- self.expires_at = data.fetch(:expires_at, nil)
138
- self.metadata = data.fetch(:metadata, nil)
139
- self.sandbox = data.fetch(:sandbox, nil)
140
- self.created_at = data.fetch(:created_at, nil)
141
-
142
- end
143
-
144
- # Create a new Discount using the current client
145
- def new(data = {})
146
- Discount.new(@client, data)
147
- end
148
-
149
- # Overrides the JSON marshaller to only send the fields we want
150
- def to_json(options)
151
- {
152
- "id": self.id,
153
- "project": self.project,
154
- "project_id": self.project_id,
155
- "subscription": self.subscription,
156
- "subscription_id": self.subscription_id,
157
- "coupon": self.coupon,
158
- "coupon_id": self.coupon_id,
159
- "name": self.name,
160
- "amount": self.amount,
161
- "percent": self.percent,
162
- "expires_at": self.expires_at,
163
- "metadata": self.metadata,
164
- "sandbox": self.sandbox,
165
- "created_at": self.created_at,
166
- }.to_json
167
- end
168
-
169
- # Fills the object with data coming from the API
170
- # Params:
171
- # +data+:: +Hash+ of data coming from the API
172
- def fill_with_data(data)
173
- if data.nil?
174
- return self
175
- end
176
- if data.include? "id"
177
- self.id = data["id"]
178
- end
179
- if data.include? "project"
180
- self.project = data["project"]
181
- end
182
- if data.include? "project_id"
183
- self.project_id = data["project_id"]
184
- end
185
- if data.include? "subscription"
186
- self.subscription = data["subscription"]
187
- end
188
- if data.include? "subscription_id"
189
- self.subscription_id = data["subscription_id"]
190
- end
191
- if data.include? "coupon"
192
- self.coupon = data["coupon"]
193
- end
194
- if data.include? "coupon_id"
195
- self.coupon_id = data["coupon_id"]
196
- end
197
- if data.include? "name"
198
- self.name = data["name"]
199
- end
200
- if data.include? "amount"
201
- self.amount = data["amount"]
202
- end
203
- if data.include? "percent"
204
- self.percent = data["percent"]
205
- end
206
- if data.include? "expires_at"
207
- self.expires_at = data["expires_at"]
208
- end
209
- if data.include? "metadata"
210
- self.metadata = data["metadata"]
211
- end
212
- if data.include? "sandbox"
213
- self.sandbox = data["sandbox"]
214
- end
215
- if data.include? "created_at"
216
- self.created_at = data["created_at"]
217
- end
218
-
219
- self
220
- end
221
-
222
- # Prefills the object with the data passed as parameters
223
- # Params:
224
- # +data+:: +Hash+ of data
225
- def prefill(data)
226
- if data.nil?
227
- return self
228
- end
229
- self.id = data.fetch(:id, self.id)
230
- self.project = data.fetch(:project, self.project)
231
- self.project_id = data.fetch(:project_id, self.project_id)
232
- self.subscription = data.fetch(:subscription, self.subscription)
233
- self.subscription_id = data.fetch(:subscription_id, self.subscription_id)
234
- self.coupon = data.fetch(:coupon, self.coupon)
235
- self.coupon_id = data.fetch(:coupon_id, self.coupon_id)
236
- self.name = data.fetch(:name, self.name)
237
- self.amount = data.fetch(:amount, self.amount)
238
- self.percent = data.fetch(:percent, self.percent)
239
- self.expires_at = data.fetch(:expires_at, self.expires_at)
240
- self.metadata = data.fetch(:metadata, self.metadata)
241
- self.sandbox = data.fetch(:sandbox, self.sandbox)
242
- self.created_at = data.fetch(:created_at, self.created_at)
243
-
244
- self
245
- end
246
-
247
- # Get the discounts applied to the subscription.
248
- # Params:
249
- # +subscription_id+:: ID of the subscription
250
- # +options+:: +Hash+ of options
251
- def fetch_subscription_discounts(subscription_id, options = {})
252
- self.prefill(options)
253
-
254
- request = Request.new(@client)
255
- path = "/subscriptions/" + CGI.escape(subscription_id) + "/discounts"
256
- data = {
257
-
258
- }
259
-
260
- response = Response.new(request.get(path, data, options))
261
- return_values = Array.new
262
-
263
- a = Array.new
264
- body = response.body
265
- for v in body['discounts']
266
- tmp = Discount.new(@client)
267
- tmp.fill_with_data(v)
268
- a.push(tmp)
269
- end
270
-
271
- return_values.push(a)
272
-
273
-
274
-
275
- return_values[0]
276
- end
277
-
278
- # Create a new discount for the given subscription ID.
279
- # Params:
280
- # +options+:: +Hash+ of options
281
- def create(options = {})
282
- self.prefill(options)
283
-
284
- request = Request.new(@client)
285
- path = "/subscriptions/" + CGI.escape(@subscription_id) + "/discounts"
286
- data = {
287
- "coupon_id" => @coupon_id,
288
- "name" => @name,
289
- "amount" => @amount,
290
- "expires_at" => @expires_at,
291
- "metadata" => @metadata
292
- }
293
-
294
- response = Response.new(request.post(path, data, options))
295
- return_values = Array.new
296
-
297
- body = response.body
298
- body = body["discount"]
299
-
300
-
301
- return_values.push(self.fill_with_data(body))
302
-
303
-
304
-
305
- return_values[0]
306
- end
307
-
308
- # Find a subscription's discount by its ID.
309
- # Params:
310
- # +subscription_id+:: ID of the subscription on which the discount was applied
311
- # +discount_id+:: ID of the discount
312
- # +options+:: +Hash+ of options
313
- def find(subscription_id, discount_id, options = {})
314
- self.prefill(options)
315
-
316
- request = Request.new(@client)
317
- path = "/subscriptions/" + CGI.escape(subscription_id) + "/discounts/" + CGI.escape(discount_id) + ""
318
- data = {
319
-
320
- }
321
-
322
- response = Response.new(request.get(path, data, options))
323
- return_values = Array.new
324
-
325
- body = response.body
326
- body = body["discount"]
327
-
328
-
329
- obj = Discount.new(@client)
330
- return_values.push(obj.fill_with_data(body))
331
-
332
-
333
-
334
- return_values[0]
335
- end
336
-
337
- # Delete a discount applied to a subscription.
338
- # Params:
339
- # +options+:: +Hash+ of options
340
- def delete(options = {})
341
- self.prefill(options)
342
-
343
- request = Request.new(@client)
344
- path = "/subscriptions/" + CGI.escape(@subscription_id) + "/discounts/" + CGI.escape(@id) + ""
345
- data = {
346
-
347
- }
348
-
349
- response = Response.new(request.delete(path, data, options))
350
- return_values = Array.new
351
-
352
- return_values.push(response.success)
353
-
354
-
355
- return_values[0]
356
- end
357
-
358
-
359
- end
360
- end