processout 2.12.0 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/lib/processout.rb +18 -0
  3. data/lib/processout/activity.rb +14 -0
  4. data/lib/processout/addon.rb +21 -0
  5. data/lib/processout/api_request.rb +21 -0
  6. data/lib/processout/api_version.rb +10 -0
  7. data/lib/processout/card.rb +79 -0
  8. data/lib/processout/card_information.rb +14 -0
  9. data/lib/processout/coupon.rb +20 -0
  10. data/lib/processout/customer.rb +62 -24
  11. data/lib/processout/customer_action.rb +9 -0
  12. data/lib/processout/discount.rb +21 -0
  13. data/lib/processout/dunning_action.rb +9 -0
  14. data/lib/processout/event.rb +14 -31
  15. data/lib/processout/gateway.rb +18 -0
  16. data/lib/processout/gateway_configuration.rb +19 -1
  17. data/lib/processout/invoice.rb +187 -1
  18. data/lib/processout/invoice_detail.rb +22 -0
  19. data/lib/processout/invoice_device.rb +20 -0
  20. data/lib/processout/invoice_external_fraud_tools.rb +70 -0
  21. data/lib/processout/invoice_risk.rb +9 -0
  22. data/lib/processout/invoice_shipping.rb +19 -0
  23. data/lib/processout/invoice_tax.rb +81 -0
  24. data/lib/processout/networking/request.rb +1 -1
  25. data/lib/processout/payment_data_network_authentication.rb +8 -0
  26. data/lib/processout/payment_data_three_ds_authentication.rb +8 -0
  27. data/lib/processout/payment_data_three_ds_request.rb +11 -0
  28. data/lib/processout/payout.rb +27 -0
  29. data/lib/processout/payout_item.rb +20 -0
  30. data/lib/processout/plan.rb +21 -0
  31. data/lib/processout/product.rb +19 -0
  32. data/lib/processout/project.rb +18 -27
  33. data/lib/processout/refund.rb +17 -0
  34. data/lib/processout/subscription.rb +42 -0
  35. data/lib/processout/three_ds.rb +103 -0
  36. data/lib/processout/token.rb +108 -23
  37. data/lib/processout/transaction.rb +113 -0
  38. data/lib/processout/transaction_operation.rb +84 -0
  39. data/lib/processout/version.rb +1 -1
  40. data/lib/processout/webhook.rb +21 -0
  41. data/lib/processout/webhook_endpoint.rb +14 -0
  42. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: aaf40ed01399a94bde8e2480ff08122752e93fe0
4
- data.tar.gz: 7bd1f3a5e23b2bf9d5dc2b8c94827ba465774f76
2
+ SHA256:
3
+ metadata.gz: 9230ecb6a7d95dd4e7329fc8dedcc36c804544bc581e69eb674db3cd3d8226c7
4
+ data.tar.gz: dd343d3e96053c300e3b5deeff8339700f6ac87873b8bacc5b07e38bb823c2a6
5
5
  SHA512:
6
- metadata.gz: 11304d37b90a1e507c0978d5c85c40ab0c3c44a8e315f320d692fb200fc56140452b46eb47307b81f615f4e5ef0c281c0128c39c6253e9a739a4026cbf5af833
7
- data.tar.gz: 63e3d240554ac748f9d273f36900b4b5cd14d5eba956ee06f6d193213d9fee50acb443fd60512288e3d460d1d193e732eed1fd85ebf5aa9869d841e0089a838d
6
+ metadata.gz: b4be5572ec3ff1c99ccbc30c69dfe5441d46ddd1cceed0f0142bbe20a0ca964ca3eb4ed8934f3e79077d801908f94fc45e7248400b0b93beccecf34755b262c5
7
+ data.tar.gz: 2486f46a2d6196910626c46079562f228cb259fc2843409a751eb576af45524881299f2c650faec6d63d6bc6b27e6ea816640a91d73c5009d8f7a0ef62c9a12d
data/lib/processout.rb CHANGED
@@ -14,6 +14,8 @@ require "processout/event"
14
14
  require "processout/gateway"
15
15
  require "processout/gateway_configuration"
16
16
  require "processout/invoice"
17
+ require "processout/invoice_tax"
18
+ require "processout/invoice_external_fraud_tools"
17
19
  require "processout/invoice_risk"
18
20
  require "processout/invoice_device"
19
21
  require "processout/invoice_shipping"
@@ -28,6 +30,7 @@ require "processout/project"
28
30
  require "processout/refund"
29
31
  require "processout/subscription"
30
32
  require "processout/transaction"
33
+ require "processout/three_ds"
31
34
  require "processout/payment_data_three_ds_request"
32
35
  require "processout/payment_data_network_authentication"
33
36
  require "processout/payment_data_three_ds_authentication"
@@ -116,6 +119,16 @@ module ProcessOut
116
119
  obj = Invoice.new(self, data)
117
120
  end
118
121
 
122
+ # Create a new InvoiceTax instance
123
+ def invoice_tax(data = {})
124
+ obj = InvoiceTax.new(self, data)
125
+ end
126
+
127
+ # Create a new InvoiceExternalFraudTools instance
128
+ def invoice_external_fraud_tools(data = {})
129
+ obj = InvoiceExternalFraudTools.new(self, data)
130
+ end
131
+
119
132
  # Create a new InvoiceRisk instance
120
133
  def invoice_risk(data = {})
121
134
  obj = InvoiceRisk.new(self, data)
@@ -186,6 +199,11 @@ module ProcessOut
186
199
  obj = Transaction.new(self, data)
187
200
  end
188
201
 
202
+ # Create a new ThreeDS instance
203
+ def three_ds(data = {})
204
+ obj = ThreeDS.new(self, data)
205
+ end
206
+
189
207
  # Create a new PaymentDataThreeDSRequest instance
190
208
  def payment_data_three_ds_request(data = {})
191
209
  obj = PaymentDataThreeDSRequest.new(self, data)
@@ -1,6 +1,7 @@
1
1
  # The content of this file was automatically generated
2
2
 
3
3
  require "cgi"
4
+ require "json"
4
5
  require "processout/networking/request"
5
6
  require "processout/networking/response"
6
7
 
@@ -79,6 +80,19 @@ module ProcessOut
79
80
  Activity.new(@client, data)
80
81
  end
81
82
 
83
+ # Overrides the JSON marshaller to only send the fields we want
84
+ def to_json(options)
85
+ {
86
+ "id": self.id,
87
+ "project": self.project,
88
+ "project_id": self.project_id,
89
+ "title": self.title,
90
+ "content": self.content,
91
+ "level": self.level,
92
+ "created_at": self.created_at,
93
+ }.to_json
94
+ end
95
+
82
96
  # Fills the object with data coming from the API
83
97
  # Params:
84
98
  # +data+:: +Hash+ of data coming from the API
@@ -1,6 +1,7 @@
1
1
  # The content of this file was automatically generated
2
2
 
3
3
  require "cgi"
4
+ require "json"
4
5
  require "processout/networking/request"
5
6
  require "processout/networking/response"
6
7
 
@@ -145,6 +146,26 @@ module ProcessOut
145
146
  Addon.new(@client, data)
146
147
  end
147
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
+ "plan": self.plan,
158
+ "plan_id": self.plan_id,
159
+ "type": self.type,
160
+ "name": self.name,
161
+ "amount": self.amount,
162
+ "quantity": self.quantity,
163
+ "metadata": self.metadata,
164
+ "sandbox": self.sandbox,
165
+ "created_at": self.created_at,
166
+ }.to_json
167
+ end
168
+
148
169
  # Fills the object with data coming from the API
149
170
  # Params:
150
171
  # +data+:: +Hash+ of data coming from the API
@@ -1,6 +1,7 @@
1
1
  # The content of this file was automatically generated
2
2
 
3
3
  require "cgi"
4
+ require "json"
4
5
  require "processout/networking/request"
5
6
  require "processout/networking/response"
6
7
 
@@ -133,6 +134,26 @@ module ProcessOut
133
134
  APIRequest.new(@client, data)
134
135
  end
135
136
 
137
+ # Overrides the JSON marshaller to only send the fields we want
138
+ def to_json(options)
139
+ {
140
+ "id": self.id,
141
+ "project": self.project,
142
+ "api_version": self.api_version,
143
+ "idempotency_key": self.idempotency_key,
144
+ "url": self.url,
145
+ "method": self.method,
146
+ "headers": self.headers,
147
+ "body": self.body,
148
+ "response_code": self.response_code,
149
+ "response_headers": self.response_headers,
150
+ "response_body": self.response_body,
151
+ "response_ms": self.response_ms,
152
+ "sandbox": self.sandbox,
153
+ "created_at": self.created_at,
154
+ }.to_json
155
+ end
156
+
136
157
  # Fills the object with data coming from the API
137
158
  # Params:
138
159
  # +data+:: +Hash+ of data coming from the API
@@ -1,6 +1,7 @@
1
1
  # The content of this file was automatically generated
2
2
 
3
3
  require "cgi"
4
+ require "json"
4
5
  require "processout/networking/request"
5
6
  require "processout/networking/response"
6
7
 
@@ -43,6 +44,15 @@ module ProcessOut
43
44
  APIVersion.new(@client, data)
44
45
  end
45
46
 
47
+ # Overrides the JSON marshaller to only send the fields we want
48
+ def to_json(options)
49
+ {
50
+ "name": self.name,
51
+ "description": self.description,
52
+ "created_at": self.created_at,
53
+ }.to_json
54
+ end
55
+
46
56
  # Fills the object with data coming from the API
47
57
  # Params:
48
58
  # +data+:: +Hash+ of data coming from the API
@@ -1,6 +1,7 @@
1
1
  # The content of this file was automatically generated
2
2
 
3
3
  require "cgi"
4
+ require "json"
4
5
  require "processout/networking/request"
5
6
  require "processout/networking/response"
6
7
 
@@ -17,6 +18,7 @@ module ProcessOut
17
18
  attr_reader :type
18
19
  attr_reader :bank_name
19
20
  attr_reader :brand
21
+ attr_reader :category
20
22
  attr_reader :iin
21
23
  attr_reader :last_4_digits
22
24
  attr_reader :exp_month
@@ -32,6 +34,7 @@ module ProcessOut
32
34
  attr_reader :country_code
33
35
  attr_reader :ip_address
34
36
  attr_reader :fingerprint
37
+ attr_reader :token_type
35
38
  attr_reader :metadata
36
39
  attr_reader :expires_soon
37
40
  attr_reader :sandbox
@@ -102,6 +105,10 @@ module ProcessOut
102
105
  @brand = val
103
106
  end
104
107
 
108
+ def category=(val)
109
+ @category = val
110
+ end
111
+
105
112
  def iin=(val)
106
113
  @iin = val
107
114
  end
@@ -162,6 +169,10 @@ module ProcessOut
162
169
  @fingerprint = val
163
170
  end
164
171
 
172
+ def token_type=(val)
173
+ @token_type = val
174
+ end
175
+
165
176
  def metadata=(val)
166
177
  @metadata = val
167
178
  end
@@ -196,6 +207,7 @@ module ProcessOut
196
207
  self.type = data.fetch(:type, nil)
197
208
  self.bank_name = data.fetch(:bank_name, nil)
198
209
  self.brand = data.fetch(:brand, nil)
210
+ self.category = data.fetch(:category, nil)
199
211
  self.iin = data.fetch(:iin, nil)
200
212
  self.last_4_digits = data.fetch(:last_4_digits, nil)
201
213
  self.exp_month = data.fetch(:exp_month, nil)
@@ -211,6 +223,7 @@ module ProcessOut
211
223
  self.country_code = data.fetch(:country_code, nil)
212
224
  self.ip_address = data.fetch(:ip_address, nil)
213
225
  self.fingerprint = data.fetch(:fingerprint, nil)
226
+ self.token_type = data.fetch(:token_type, nil)
214
227
  self.metadata = data.fetch(:metadata, nil)
215
228
  self.expires_soon = data.fetch(:expires_soon, nil)
216
229
  self.sandbox = data.fetch(:sandbox, nil)
@@ -223,6 +236,43 @@ module ProcessOut
223
236
  Card.new(@client, data)
224
237
  end
225
238
 
239
+ # Overrides the JSON marshaller to only send the fields we want
240
+ def to_json(options)
241
+ {
242
+ "id": self.id,
243
+ "project": self.project,
244
+ "project_id": self.project_id,
245
+ "token": self.token,
246
+ "scheme": self.scheme,
247
+ "co_scheme": self.co_scheme,
248
+ "preferred_scheme": self.preferred_scheme,
249
+ "type": self.type,
250
+ "bank_name": self.bank_name,
251
+ "brand": self.brand,
252
+ "category": self.category,
253
+ "iin": self.iin,
254
+ "last_4_digits": self.last_4_digits,
255
+ "exp_month": self.exp_month,
256
+ "exp_year": self.exp_year,
257
+ "cvc_check": self.cvc_check,
258
+ "avs_check": self.avs_check,
259
+ "name": self.name,
260
+ "address1": self.address1,
261
+ "address2": self.address2,
262
+ "city": self.city,
263
+ "state": self.state,
264
+ "zip": self.zip,
265
+ "country_code": self.country_code,
266
+ "ip_address": self.ip_address,
267
+ "fingerprint": self.fingerprint,
268
+ "token_type": self.token_type,
269
+ "metadata": self.metadata,
270
+ "expires_soon": self.expires_soon,
271
+ "sandbox": self.sandbox,
272
+ "created_at": self.created_at,
273
+ }.to_json
274
+ end
275
+
226
276
  # Fills the object with data coming from the API
227
277
  # Params:
228
278
  # +data+:: +Hash+ of data coming from the API
@@ -260,6 +310,9 @@ module ProcessOut
260
310
  if data.include? "brand"
261
311
  self.brand = data["brand"]
262
312
  end
313
+ if data.include? "category"
314
+ self.category = data["category"]
315
+ end
263
316
  if data.include? "iin"
264
317
  self.iin = data["iin"]
265
318
  end
@@ -305,6 +358,9 @@ module ProcessOut
305
358
  if data.include? "fingerprint"
306
359
  self.fingerprint = data["fingerprint"]
307
360
  end
361
+ if data.include? "token_type"
362
+ self.token_type = data["token_type"]
363
+ end
308
364
  if data.include? "metadata"
309
365
  self.metadata = data["metadata"]
310
366
  end
@@ -338,6 +394,7 @@ module ProcessOut
338
394
  self.type = data.fetch(:type, self.type)
339
395
  self.bank_name = data.fetch(:bank_name, self.bank_name)
340
396
  self.brand = data.fetch(:brand, self.brand)
397
+ self.category = data.fetch(:category, self.category)
341
398
  self.iin = data.fetch(:iin, self.iin)
342
399
  self.last_4_digits = data.fetch(:last_4_digits, self.last_4_digits)
343
400
  self.exp_month = data.fetch(:exp_month, self.exp_month)
@@ -353,6 +410,7 @@ module ProcessOut
353
410
  self.country_code = data.fetch(:country_code, self.country_code)
354
411
  self.ip_address = data.fetch(:ip_address, self.ip_address)
355
412
  self.fingerprint = data.fetch(:fingerprint, self.fingerprint)
413
+ self.token_type = data.fetch(:token_type, self.token_type)
356
414
  self.metadata = data.fetch(:metadata, self.metadata)
357
415
  self.expires_soon = data.fetch(:expires_soon, self.expires_soon)
358
416
  self.sandbox = data.fetch(:sandbox, self.sandbox)
@@ -416,6 +474,27 @@ module ProcessOut
416
474
 
417
475
 
418
476
 
477
+ return_values[0]
478
+ end
479
+
480
+ # Anonymize the card.
481
+ # Params:
482
+ # +options+:: +Hash+ of options
483
+ def anonymize(options = {})
484
+ self.prefill(options)
485
+
486
+ request = Request.new(@client)
487
+ path = "/cards/" + CGI.escape(@id) + ""
488
+ data = {
489
+
490
+ }
491
+
492
+ response = Response.new(request.delete(path, data, options))
493
+ return_values = Array.new
494
+
495
+ return_values.push(response.success)
496
+
497
+
419
498
  return_values[0]
420
499
  end
421
500
 
@@ -1,6 +1,7 @@
1
1
  # The content of this file was automatically generated
2
2
 
3
3
  require "cgi"
4
+ require "json"
4
5
  require "processout/networking/request"
5
6
  require "processout/networking/response"
6
7
 
@@ -67,6 +68,19 @@ module ProcessOut
67
68
  CardInformation.new(@client, data)
68
69
  end
69
70
 
71
+ # Overrides the JSON marshaller to only send the fields we want
72
+ def to_json(options)
73
+ {
74
+ "iin": self.iin,
75
+ "scheme": self.scheme,
76
+ "type": self.type,
77
+ "bank_name": self.bank_name,
78
+ "brand": self.brand,
79
+ "category": self.category,
80
+ "country": self.country,
81
+ }.to_json
82
+ end
83
+
70
84
  # Fills the object with data coming from the API
71
85
  # Params:
72
86
  # +data+:: +Hash+ of data coming from the API
@@ -1,6 +1,7 @@
1
1
  # The content of this file was automatically generated
2
2
 
3
3
  require "cgi"
4
+ require "json"
4
5
  require "processout/networking/request"
5
6
  require "processout/networking/response"
6
7
 
@@ -115,6 +116,25 @@ module ProcessOut
115
116
  Coupon.new(@client, data)
116
117
  end
117
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
+
118
138
  # Fills the object with data coming from the API
119
139
  # Params:
120
140
  # +data+:: +Hash+ of data coming from the API
@@ -1,6 +1,7 @@
1
1
  # The content of this file was automatically generated
2
2
 
3
3
  require "cgi"
4
+ require "json"
4
5
  require "processout/networking/request"
5
6
  require "processout/networking/response"
6
7
 
@@ -34,6 +35,8 @@ module ProcessOut
34
35
  attr_reader :metadata
35
36
  attr_reader :sandbox
36
37
  attr_reader :created_at
38
+ attr_reader :registered_at
39
+ attr_reader :date_of_birth
37
40
 
38
41
 
39
42
  def id=(val)
@@ -216,6 +219,14 @@ module ProcessOut
216
219
  @created_at = val
217
220
  end
218
221
 
222
+ def registered_at=(val)
223
+ @registered_at = val
224
+ end
225
+
226
+ def date_of_birth=(val)
227
+ @date_of_birth = val
228
+ end
229
+
219
230
 
220
231
  # Initializes the Customer object
221
232
  # Params:
@@ -251,6 +262,8 @@ module ProcessOut
251
262
  self.metadata = data.fetch(:metadata, nil)
252
263
  self.sandbox = data.fetch(:sandbox, nil)
253
264
  self.created_at = data.fetch(:created_at, nil)
265
+ self.registered_at = data.fetch(:registered_at, nil)
266
+ self.date_of_birth = data.fetch(:date_of_birth, nil)
254
267
 
255
268
  end
256
269
 
@@ -259,6 +272,41 @@ module ProcessOut
259
272
  Customer.new(@client, data)
260
273
  end
261
274
 
275
+ # Overrides the JSON marshaller to only send the fields we want
276
+ def to_json(options)
277
+ {
278
+ "id": self.id,
279
+ "project": self.project,
280
+ "project_id": self.project_id,
281
+ "default_token": self.default_token,
282
+ "default_token_id": self.default_token_id,
283
+ "tokens": self.tokens,
284
+ "subscriptions": self.subscriptions,
285
+ "transactions": self.transactions,
286
+ "balance": self.balance,
287
+ "currency": self.currency,
288
+ "email": self.email,
289
+ "first_name": self.first_name,
290
+ "last_name": self.last_name,
291
+ "address1": self.address1,
292
+ "address2": self.address2,
293
+ "city": self.city,
294
+ "state": self.state,
295
+ "zip": self.zip,
296
+ "country_code": self.country_code,
297
+ "ip_address": self.ip_address,
298
+ "phone_number": self.phone_number,
299
+ "legal_document": self.legal_document,
300
+ "sex": self.sex,
301
+ "is_business": self.is_business,
302
+ "metadata": self.metadata,
303
+ "sandbox": self.sandbox,
304
+ "created_at": self.created_at,
305
+ "registered_at": self.registered_at,
306
+ "date_of_birth": self.date_of_birth,
307
+ }.to_json
308
+ end
309
+
262
310
  # Fills the object with data coming from the API
263
311
  # Params:
264
312
  # +data+:: +Hash+ of data coming from the API
@@ -347,6 +395,12 @@ module ProcessOut
347
395
  if data.include? "created_at"
348
396
  self.created_at = data["created_at"]
349
397
  end
398
+ if data.include? "registered_at"
399
+ self.registered_at = data["registered_at"]
400
+ end
401
+ if data.include? "date_of_birth"
402
+ self.date_of_birth = data["date_of_birth"]
403
+ end
350
404
 
351
405
  self
352
406
  end
@@ -385,6 +439,8 @@ module ProcessOut
385
439
  self.metadata = data.fetch(:metadata, self.metadata)
386
440
  self.sandbox = data.fetch(:sandbox, self.sandbox)
387
441
  self.created_at = data.fetch(:created_at, self.created_at)
442
+ self.registered_at = data.fetch(:registered_at, self.registered_at)
443
+ self.date_of_birth = data.fetch(:date_of_birth, self.date_of_birth)
388
444
 
389
445
  self
390
446
  end
@@ -416,28 +472,6 @@ module ProcessOut
416
472
 
417
473
 
418
474
 
419
- return_values[0]
420
- end
421
-
422
- # Verify a customer token's card is valid.
423
- # Params:
424
- # +token_id+:: ID of the token
425
- # +options+:: +Hash+ of options
426
- def verify_token(token_id, options = {})
427
- self.prefill(options)
428
-
429
- request = Request.new(@client)
430
- path = "/customers/" + CGI.escape(@id) + "/tokens/" + CGI.escape(token_id) + "/verify"
431
- data = {
432
-
433
- }
434
-
435
- response = Response.new(request.post(path, data, options))
436
- return_values = Array.new
437
-
438
- return_values.push(response.success)
439
-
440
-
441
475
  return_values[0]
442
476
  end
443
477
 
@@ -601,10 +635,12 @@ module ProcessOut
601
635
  "ip_address" => @ip_address,
602
636
  "phone_number" => @phone_number,
603
637
  "legal_document" => @legal_document,
638
+ "date_of_birth" => @date_of_birth,
604
639
  "is_business" => @is_business,
605
640
  "sex" => @sex,
606
641
  "metadata" => @metadata,
607
- "id" => @id
642
+ "id" => @id,
643
+ "registered_at" => @registered_at
608
644
  }
609
645
 
610
646
  response = Response.new(request.post(path, data, options))
@@ -672,9 +708,11 @@ module ProcessOut
672
708
  "ip_address" => @ip_address,
673
709
  "phone_number" => @phone_number,
674
710
  "legal_document" => @legal_document,
711
+ "date_of_birth" => @date_of_birth,
675
712
  "is_business" => @is_business,
676
713
  "sex" => @sex,
677
- "metadata" => @metadata
714
+ "metadata" => @metadata,
715
+ "registered_at" => @registered_at
678
716
  }
679
717
 
680
718
  response = Response.new(request.put(path, data, options))