processout 2.11.0 → 2.14.4

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 +12 -6
  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 +136 -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/networking/request.rb +1 -1
  24. data/lib/processout/payment_data_network_authentication.rb +8 -0
  25. data/lib/processout/payment_data_three_ds_authentication.rb +8 -0
  26. data/lib/processout/payment_data_three_ds_request.rb +11 -0
  27. data/lib/processout/payout.rb +27 -0
  28. data/lib/processout/payout_item.rb +20 -0
  29. data/lib/processout/plan.rb +21 -0
  30. data/lib/processout/product.rb +19 -0
  31. data/lib/processout/project.rb +18 -27
  32. data/lib/processout/refund.rb +17 -0
  33. data/lib/processout/subscription.rb +42 -0
  34. data/lib/processout/three_ds.rb +103 -0
  35. data/lib/processout/token.rb +138 -22
  36. data/lib/processout/transaction.rb +113 -0
  37. data/lib/processout/transaction_operation.rb +94 -0
  38. data/lib/processout/version.rb +1 -1
  39. data/lib/processout/webhook.rb +21 -0
  40. data/lib/processout/webhook_endpoint.rb +14 -0
  41. metadata +5 -5
  42. data/lib/processout/authorization_request.rb +0 -320
@@ -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
 
@@ -37,6 +38,7 @@ module ProcessOut
37
38
  attr_reader :available_amount_local
38
39
  attr_reader :currency
39
40
  attr_reader :error_code
41
+ attr_reader :error_message
40
42
  attr_reader :gateway_name
41
43
  attr_reader :three_d_s_status
42
44
  attr_reader :status
@@ -57,6 +59,9 @@ module ProcessOut
57
59
  attr_reader :created_at
58
60
  attr_reader :chargedback_at
59
61
  attr_reader :refunded_at
62
+ attr_reader :three_d_s
63
+ attr_reader :cvc_check
64
+ attr_reader :avs_check
60
65
 
61
66
 
62
67
  def id=(val)
@@ -295,6 +300,10 @@ module ProcessOut
295
300
  @error_code = val
296
301
  end
297
302
 
303
+ def error_message=(val)
304
+ @error_message = val
305
+ end
306
+
298
307
  def gateway_name=(val)
299
308
  @gateway_name = val
300
309
  end
@@ -375,6 +384,30 @@ module ProcessOut
375
384
  @refunded_at = val
376
385
  end
377
386
 
387
+ def three_d_s=(val)
388
+ if val.nil?
389
+ @three_d_s = val
390
+ return
391
+ end
392
+
393
+ if val.instance_of? ThreeDS
394
+ @three_d_s = val
395
+ else
396
+ obj = ThreeDS.new(@client)
397
+ obj.fill_with_data(val)
398
+ @three_d_s = obj
399
+ end
400
+
401
+ end
402
+
403
+ def cvc_check=(val)
404
+ @cvc_check = val
405
+ end
406
+
407
+ def avs_check=(val)
408
+ @avs_check = val
409
+ end
410
+
378
411
 
379
412
  # Initializes the Transaction object
380
413
  # Params:
@@ -413,6 +446,7 @@ module ProcessOut
413
446
  self.available_amount_local = data.fetch(:available_amount_local, nil)
414
447
  self.currency = data.fetch(:currency, nil)
415
448
  self.error_code = data.fetch(:error_code, nil)
449
+ self.error_message = data.fetch(:error_message, nil)
416
450
  self.gateway_name = data.fetch(:gateway_name, nil)
417
451
  self.three_d_s_status = data.fetch(:three_d_s_status, nil)
418
452
  self.status = data.fetch(:status, nil)
@@ -433,6 +467,9 @@ module ProcessOut
433
467
  self.created_at = data.fetch(:created_at, nil)
434
468
  self.chargedback_at = data.fetch(:chargedback_at, nil)
435
469
  self.refunded_at = data.fetch(:refunded_at, nil)
470
+ self.three_d_s = data.fetch(:three_d_s, nil)
471
+ self.cvc_check = data.fetch(:cvc_check, nil)
472
+ self.avs_check = data.fetch(:avs_check, nil)
436
473
 
437
474
  end
438
475
 
@@ -441,6 +478,66 @@ module ProcessOut
441
478
  Transaction.new(@client, data)
442
479
  end
443
480
 
481
+ # Overrides the JSON marshaller to only send the fields we want
482
+ def to_json(options)
483
+ {
484
+ "id": self.id,
485
+ "project": self.project,
486
+ "project_id": self.project_id,
487
+ "invoice": self.invoice,
488
+ "invoice_id": self.invoice_id,
489
+ "customer": self.customer,
490
+ "customer_id": self.customer_id,
491
+ "subscription": self.subscription,
492
+ "subscription_id": self.subscription_id,
493
+ "token": self.token,
494
+ "token_id": self.token_id,
495
+ "card": self.card,
496
+ "card_id": self.card_id,
497
+ "gateway_configuration": self.gateway_configuration,
498
+ "gateway_configuration_id": self.gateway_configuration_id,
499
+ "operations": self.operations,
500
+ "refunds": self.refunds,
501
+ "name": self.name,
502
+ "amount": self.amount,
503
+ "amount_local": self.amount_local,
504
+ "authorized_amount": self.authorized_amount,
505
+ "authorized_amount_local": self.authorized_amount_local,
506
+ "captured_amount": self.captured_amount,
507
+ "captured_amount_local": self.captured_amount_local,
508
+ "refunded_amount": self.refunded_amount,
509
+ "refunded_amount_local": self.refunded_amount_local,
510
+ "available_amount": self.available_amount,
511
+ "available_amount_local": self.available_amount_local,
512
+ "currency": self.currency,
513
+ "error_code": self.error_code,
514
+ "error_message": self.error_message,
515
+ "gateway_name": self.gateway_name,
516
+ "three_d_s_status": self.three_d_s_status,
517
+ "status": self.status,
518
+ "authorized": self.authorized,
519
+ "captured": self.captured,
520
+ "voided": self.voided,
521
+ "refunded": self.refunded,
522
+ "chargedback": self.chargedback,
523
+ "received_fraud_notification": self.received_fraud_notification,
524
+ "received_retrieval_request": self.received_retrieval_request,
525
+ "processout_fee": self.processout_fee,
526
+ "estimated_fee": self.estimated_fee,
527
+ "gateway_fee": self.gateway_fee,
528
+ "gateway_fee_local": self.gateway_fee_local,
529
+ "currency_fee": self.currency_fee,
530
+ "metadata": self.metadata,
531
+ "sandbox": self.sandbox,
532
+ "created_at": self.created_at,
533
+ "chargedback_at": self.chargedback_at,
534
+ "refunded_at": self.refunded_at,
535
+ "three_d_s": self.three_d_s,
536
+ "cvc_check": self.cvc_check,
537
+ "avs_check": self.avs_check,
538
+ }.to_json
539
+ end
540
+
444
541
  # Fills the object with data coming from the API
445
542
  # Params:
446
543
  # +data+:: +Hash+ of data coming from the API
@@ -538,6 +635,9 @@ module ProcessOut
538
635
  if data.include? "error_code"
539
636
  self.error_code = data["error_code"]
540
637
  end
638
+ if data.include? "error_message"
639
+ self.error_message = data["error_message"]
640
+ end
541
641
  if data.include? "gateway_name"
542
642
  self.gateway_name = data["gateway_name"]
543
643
  end
@@ -598,6 +698,15 @@ module ProcessOut
598
698
  if data.include? "refunded_at"
599
699
  self.refunded_at = data["refunded_at"]
600
700
  end
701
+ if data.include? "three_d_s"
702
+ self.three_d_s = data["three_d_s"]
703
+ end
704
+ if data.include? "cvc_check"
705
+ self.cvc_check = data["cvc_check"]
706
+ end
707
+ if data.include? "avs_check"
708
+ self.avs_check = data["avs_check"]
709
+ end
601
710
 
602
711
  self
603
712
  end
@@ -639,6 +748,7 @@ module ProcessOut
639
748
  self.available_amount_local = data.fetch(:available_amount_local, self.available_amount_local)
640
749
  self.currency = data.fetch(:currency, self.currency)
641
750
  self.error_code = data.fetch(:error_code, self.error_code)
751
+ self.error_message = data.fetch(:error_message, self.error_message)
642
752
  self.gateway_name = data.fetch(:gateway_name, self.gateway_name)
643
753
  self.three_d_s_status = data.fetch(:three_d_s_status, self.three_d_s_status)
644
754
  self.status = data.fetch(:status, self.status)
@@ -659,6 +769,9 @@ module ProcessOut
659
769
  self.created_at = data.fetch(:created_at, self.created_at)
660
770
  self.chargedback_at = data.fetch(:chargedback_at, self.chargedback_at)
661
771
  self.refunded_at = data.fetch(:refunded_at, self.refunded_at)
772
+ self.three_d_s = data.fetch(:three_d_s, self.three_d_s)
773
+ self.cvc_check = data.fetch(:cvc_check, self.cvc_check)
774
+ self.avs_check = data.fetch(:avs_check, self.avs_check)
662
775
 
663
776
  self
664
777
  end
@@ -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
 
@@ -14,13 +15,18 @@ module ProcessOut
14
15
  attr_reader :token_id
15
16
  attr_reader :card
16
17
  attr_reader :card_id
18
+ attr_reader :gateway_configuration
19
+ attr_reader :gateway_configuration_id
17
20
  attr_reader :amount
21
+ attr_reader :currency
18
22
  attr_reader :is_attempt
19
23
  attr_reader :has_failed
20
24
  attr_reader :is_accountable
21
25
  attr_reader :type
22
26
  attr_reader :gateway_operation_id
27
+ attr_reader :arn
23
28
  attr_reader :error_code
29
+ attr_reader :gateway_data
24
30
  attr_reader :payment_data_three_d_s_request
25
31
  attr_reader :payment_data_three_d_s_authentication
26
32
  attr_reader :payment_data_network_authentication
@@ -93,10 +99,34 @@ module ProcessOut
93
99
  @card_id = val
94
100
  end
95
101
 
102
+ def gateway_configuration=(val)
103
+ if val.nil?
104
+ @gateway_configuration = val
105
+ return
106
+ end
107
+
108
+ if val.instance_of? GatewayConfiguration
109
+ @gateway_configuration = val
110
+ else
111
+ obj = GatewayConfiguration.new(@client)
112
+ obj.fill_with_data(val)
113
+ @gateway_configuration = obj
114
+ end
115
+
116
+ end
117
+
118
+ def gateway_configuration_id=(val)
119
+ @gateway_configuration_id = val
120
+ end
121
+
96
122
  def amount=(val)
97
123
  @amount = val
98
124
  end
99
125
 
126
+ def currency=(val)
127
+ @currency = val
128
+ end
129
+
100
130
  def is_attempt=(val)
101
131
  @is_attempt = val
102
132
  end
@@ -117,10 +147,18 @@ module ProcessOut
117
147
  @gateway_operation_id = val
118
148
  end
119
149
 
150
+ def arn=(val)
151
+ @arn = val
152
+ end
153
+
120
154
  def error_code=(val)
121
155
  @error_code = val
122
156
  end
123
157
 
158
+ def gateway_data=(val)
159
+ @gateway_data = val
160
+ end
161
+
124
162
  def payment_data_three_d_s_request=(val)
125
163
  if val.nil?
126
164
  @payment_data_three_d_s_request = val
@@ -196,13 +234,18 @@ module ProcessOut
196
234
  self.token_id = data.fetch(:token_id, nil)
197
235
  self.card = data.fetch(:card, nil)
198
236
  self.card_id = data.fetch(:card_id, nil)
237
+ self.gateway_configuration = data.fetch(:gateway_configuration, nil)
238
+ self.gateway_configuration_id = data.fetch(:gateway_configuration_id, nil)
199
239
  self.amount = data.fetch(:amount, nil)
240
+ self.currency = data.fetch(:currency, nil)
200
241
  self.is_attempt = data.fetch(:is_attempt, nil)
201
242
  self.has_failed = data.fetch(:has_failed, nil)
202
243
  self.is_accountable = data.fetch(:is_accountable, nil)
203
244
  self.type = data.fetch(:type, nil)
204
245
  self.gateway_operation_id = data.fetch(:gateway_operation_id, nil)
246
+ self.arn = data.fetch(:arn, nil)
205
247
  self.error_code = data.fetch(:error_code, nil)
248
+ self.gateway_data = data.fetch(:gateway_data, nil)
206
249
  self.payment_data_three_d_s_request = data.fetch(:payment_data_three_d_s_request, nil)
207
250
  self.payment_data_three_d_s_authentication = data.fetch(:payment_data_three_d_s_authentication, nil)
208
251
  self.payment_data_network_authentication = data.fetch(:payment_data_network_authentication, nil)
@@ -217,6 +260,37 @@ module ProcessOut
217
260
  TransactionOperation.new(@client, data)
218
261
  end
219
262
 
263
+ # Overrides the JSON marshaller to only send the fields we want
264
+ def to_json(options)
265
+ {
266
+ "id": self.id,
267
+ "transaction": self.transaction,
268
+ "transaction_id": self.transaction_id,
269
+ "token": self.token,
270
+ "token_id": self.token_id,
271
+ "card": self.card,
272
+ "card_id": self.card_id,
273
+ "gateway_configuration": self.gateway_configuration,
274
+ "gateway_configuration_id": self.gateway_configuration_id,
275
+ "amount": self.amount,
276
+ "currency": self.currency,
277
+ "is_attempt": self.is_attempt,
278
+ "has_failed": self.has_failed,
279
+ "is_accountable": self.is_accountable,
280
+ "type": self.type,
281
+ "gateway_operation_id": self.gateway_operation_id,
282
+ "arn": self.arn,
283
+ "error_code": self.error_code,
284
+ "gateway_data": self.gateway_data,
285
+ "payment_data_three_d_s_request": self.payment_data_three_d_s_request,
286
+ "payment_data_three_d_s_authentication": self.payment_data_three_d_s_authentication,
287
+ "payment_data_network_authentication": self.payment_data_network_authentication,
288
+ "metadata": self.metadata,
289
+ "gateway_fee": self.gateway_fee,
290
+ "created_at": self.created_at,
291
+ }.to_json
292
+ end
293
+
220
294
  # Fills the object with data coming from the API
221
295
  # Params:
222
296
  # +data+:: +Hash+ of data coming from the API
@@ -245,9 +319,18 @@ module ProcessOut
245
319
  if data.include? "card_id"
246
320
  self.card_id = data["card_id"]
247
321
  end
322
+ if data.include? "gateway_configuration"
323
+ self.gateway_configuration = data["gateway_configuration"]
324
+ end
325
+ if data.include? "gateway_configuration_id"
326
+ self.gateway_configuration_id = data["gateway_configuration_id"]
327
+ end
248
328
  if data.include? "amount"
249
329
  self.amount = data["amount"]
250
330
  end
331
+ if data.include? "currency"
332
+ self.currency = data["currency"]
333
+ end
251
334
  if data.include? "is_attempt"
252
335
  self.is_attempt = data["is_attempt"]
253
336
  end
@@ -263,9 +346,15 @@ module ProcessOut
263
346
  if data.include? "gateway_operation_id"
264
347
  self.gateway_operation_id = data["gateway_operation_id"]
265
348
  end
349
+ if data.include? "arn"
350
+ self.arn = data["arn"]
351
+ end
266
352
  if data.include? "error_code"
267
353
  self.error_code = data["error_code"]
268
354
  end
355
+ if data.include? "gateway_data"
356
+ self.gateway_data = data["gateway_data"]
357
+ end
269
358
  if data.include? "payment_data_three_d_s_request"
270
359
  self.payment_data_three_d_s_request = data["payment_data_three_d_s_request"]
271
360
  end
@@ -302,13 +391,18 @@ module ProcessOut
302
391
  self.token_id = data.fetch(:token_id, self.token_id)
303
392
  self.card = data.fetch(:card, self.card)
304
393
  self.card_id = data.fetch(:card_id, self.card_id)
394
+ self.gateway_configuration = data.fetch(:gateway_configuration, self.gateway_configuration)
395
+ self.gateway_configuration_id = data.fetch(:gateway_configuration_id, self.gateway_configuration_id)
305
396
  self.amount = data.fetch(:amount, self.amount)
397
+ self.currency = data.fetch(:currency, self.currency)
306
398
  self.is_attempt = data.fetch(:is_attempt, self.is_attempt)
307
399
  self.has_failed = data.fetch(:has_failed, self.has_failed)
308
400
  self.is_accountable = data.fetch(:is_accountable, self.is_accountable)
309
401
  self.type = data.fetch(:type, self.type)
310
402
  self.gateway_operation_id = data.fetch(:gateway_operation_id, self.gateway_operation_id)
403
+ self.arn = data.fetch(:arn, self.arn)
311
404
  self.error_code = data.fetch(:error_code, self.error_code)
405
+ self.gateway_data = data.fetch(:gateway_data, self.gateway_data)
312
406
  self.payment_data_three_d_s_request = data.fetch(:payment_data_three_d_s_request, self.payment_data_three_d_s_request)
313
407
  self.payment_data_three_d_s_authentication = data.fetch(:payment_data_three_d_s_authentication, self.payment_data_three_d_s_authentication)
314
408
  self.payment_data_network_authentication = data.fetch(:payment_data_network_authentication, self.payment_data_network_authentication)
@@ -1,3 +1,3 @@
1
1
  module ProcessOut
2
- VERSION = "2.11.0"
2
+ VERSION = "2.14.4"
3
3
  end
@@ -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
  Webhook.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
+ "project_id": self.project_id,
143
+ "event": self.event,
144
+ "event_id": self.event_id,
145
+ "request_url": self.request_url,
146
+ "request_method": self.request_method,
147
+ "response_body": self.response_body,
148
+ "response_code": self.response_code,
149
+ "response_headers": self.response_headers,
150
+ "response_time_ms": self.response_time_ms,
151
+ "status": self.status,
152
+ "created_at": self.created_at,
153
+ "release_at": self.release_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
 
@@ -80,6 +81,19 @@ module ProcessOut
80
81
  WebhookEndpoint.new(@client, data)
81
82
  end
82
83
 
84
+ # Overrides the JSON marshaller to only send the fields we want
85
+ def to_json(options)
86
+ {
87
+ "id": self.id,
88
+ "project": self.project,
89
+ "project_id": self.project_id,
90
+ "url": self.url,
91
+ "events_whitelist": self.events_whitelist,
92
+ "sandbox": self.sandbox,
93
+ "created_at": self.created_at,
94
+ }.to_json
95
+ end
96
+
83
97
  # Fills the object with data coming from the API
84
98
  # Params:
85
99
  # +data+:: +Hash+ of data coming from the API