processout 2.19.0 → 2.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. metadata +4 -67
  3. data/.gitignore +0 -52
  4. data/.rspec +0 -2
  5. data/.travis.yml +0 -5
  6. data/Dockerfile +0 -7
  7. data/Gemfile +0 -4
  8. data/LICENSE.txt +0 -21
  9. data/Makefile +0 -4
  10. data/README.md +0 -12
  11. data/Rakefile +0 -6
  12. data/bin/console +0 -14
  13. data/bin/setup +0 -8
  14. data/lib/processout/activity.rb +0 -206
  15. data/lib/processout/addon.rb +0 -401
  16. data/lib/processout/alternative_merchant_certificate.rb +0 -94
  17. data/lib/processout/api_request.rb +0 -295
  18. data/lib/processout/api_version.rb +0 -92
  19. data/lib/processout/apple_pay_alternative_merchant_certificates.rb +0 -110
  20. data/lib/processout/balance.rb +0 -81
  21. data/lib/processout/balances.rb +0 -111
  22. data/lib/processout/card.rb +0 -503
  23. data/lib/processout/card_information.rb +0 -164
  24. data/lib/processout/coupon.rb +0 -352
  25. data/lib/processout/customer.rb +0 -755
  26. data/lib/processout/customer_action.rb +0 -81
  27. data/lib/processout/discount.rb +0 -360
  28. data/lib/processout/dunning_action.rb +0 -81
  29. data/lib/processout/errors/authentication_error.rb +0 -9
  30. data/lib/processout/errors/generic_error.rb +0 -9
  31. data/lib/processout/errors/internal_error.rb +0 -9
  32. data/lib/processout/errors/notfound_error.rb +0 -9
  33. data/lib/processout/errors/validation_error.rb +0 -9
  34. data/lib/processout/event.rb +0 -237
  35. data/lib/processout/gateway.rb +0 -210
  36. data/lib/processout/gateway_configuration.rb +0 -346
  37. data/lib/processout/gateway_request.rb +0 -26
  38. data/lib/processout/invoice.rb +0 -945
  39. data/lib/processout/invoice_detail.rb +0 -235
  40. data/lib/processout/invoice_device.rb +0 -92
  41. data/lib/processout/invoice_external_fraud_tools.rb +0 -70
  42. data/lib/processout/invoice_risk.rb +0 -81
  43. data/lib/processout/invoice_shipping.rb +0 -191
  44. data/lib/processout/invoice_tax.rb +0 -81
  45. data/lib/processout/networking/request.rb +0 -102
  46. data/lib/processout/networking/response.rb +0 -67
  47. data/lib/processout/payment_data_network_authentication.rb +0 -70
  48. data/lib/processout/payment_data_three_ds_authentication.rb +0 -70
  49. data/lib/processout/payment_data_three_ds_request.rb +0 -103
  50. data/lib/processout/payout.rb +0 -379
  51. data/lib/processout/payout_item.rb +0 -238
  52. data/lib/processout/plan.rb +0 -368
  53. data/lib/processout/product.rb +0 -368
  54. data/lib/processout/project.rb +0 -353
  55. data/lib/processout/refund.rb +0 -277
  56. data/lib/processout/subscription.rb +0 -910
  57. data/lib/processout/three_ds.rb +0 -158
  58. data/lib/processout/token.rb +0 -493
  59. data/lib/processout/transaction.rb +0 -905
  60. data/lib/processout/transaction_operation.rb +0 -418
  61. data/lib/processout/version.rb +0 -3
  62. data/lib/processout/webhook.rb +0 -237
  63. data/lib/processout/webhook_endpoint.rb +0 -149
  64. data/lib/processout.rb +0 -263
  65. data/processout.gemspec +0 -26
@@ -1,905 +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 Transaction
10
-
11
- attr_reader :id
12
- attr_reader :project
13
- attr_reader :project_id
14
- attr_reader :invoice
15
- attr_reader :invoice_id
16
- attr_reader :customer
17
- attr_reader :customer_id
18
- attr_reader :subscription
19
- attr_reader :subscription_id
20
- attr_reader :token
21
- attr_reader :token_id
22
- attr_reader :card
23
- attr_reader :card_id
24
- attr_reader :gateway_configuration
25
- attr_reader :gateway_configuration_id
26
- attr_reader :operations
27
- attr_reader :refunds
28
- attr_reader :name
29
- attr_reader :amount
30
- attr_reader :amount_local
31
- attr_reader :authorized_amount
32
- attr_reader :authorized_amount_local
33
- attr_reader :captured_amount
34
- attr_reader :captured_amount_local
35
- attr_reader :refunded_amount
36
- attr_reader :refunded_amount_local
37
- attr_reader :available_amount
38
- attr_reader :available_amount_local
39
- attr_reader :currency
40
- attr_reader :error_code
41
- attr_reader :error_message
42
- attr_reader :acquirer_name
43
- attr_reader :gateway_name
44
- attr_reader :three_d_s_status
45
- attr_reader :status
46
- attr_reader :authorized
47
- attr_reader :captured
48
- attr_reader :voided
49
- attr_reader :refunded
50
- attr_reader :chargedback
51
- attr_reader :received_fraud_notification
52
- attr_reader :received_retrieval_request
53
- attr_reader :processout_fee
54
- attr_reader :estimated_fee
55
- attr_reader :gateway_fee
56
- attr_reader :gateway_fee_local
57
- attr_reader :currency_fee
58
- attr_reader :metadata
59
- attr_reader :sandbox
60
- attr_reader :created_at
61
- attr_reader :chargedback_at
62
- attr_reader :refunded_at
63
- attr_reader :three_d_s
64
- attr_reader :cvc_check
65
- attr_reader :avs_check
66
-
67
-
68
- def id=(val)
69
- @id = val
70
- end
71
-
72
- def project=(val)
73
- if val.nil?
74
- @project = val
75
- return
76
- end
77
-
78
- if val.instance_of? Project
79
- @project = val
80
- else
81
- obj = Project.new(@client)
82
- obj.fill_with_data(val)
83
- @project = obj
84
- end
85
-
86
- end
87
-
88
- def project_id=(val)
89
- @project_id = val
90
- end
91
-
92
- def invoice=(val)
93
- if val.nil?
94
- @invoice = val
95
- return
96
- end
97
-
98
- if val.instance_of? Invoice
99
- @invoice = val
100
- else
101
- obj = Invoice.new(@client)
102
- obj.fill_with_data(val)
103
- @invoice = obj
104
- end
105
-
106
- end
107
-
108
- def invoice_id=(val)
109
- @invoice_id = val
110
- end
111
-
112
- def customer=(val)
113
- if val.nil?
114
- @customer = val
115
- return
116
- end
117
-
118
- if val.instance_of? Customer
119
- @customer = val
120
- else
121
- obj = Customer.new(@client)
122
- obj.fill_with_data(val)
123
- @customer = obj
124
- end
125
-
126
- end
127
-
128
- def customer_id=(val)
129
- @customer_id = val
130
- end
131
-
132
- def subscription=(val)
133
- if val.nil?
134
- @subscription = val
135
- return
136
- end
137
-
138
- if val.instance_of? Subscription
139
- @subscription = val
140
- else
141
- obj = Subscription.new(@client)
142
- obj.fill_with_data(val)
143
- @subscription = obj
144
- end
145
-
146
- end
147
-
148
- def subscription_id=(val)
149
- @subscription_id = val
150
- end
151
-
152
- def token=(val)
153
- if val.nil?
154
- @token = val
155
- return
156
- end
157
-
158
- if val.instance_of? Token
159
- @token = val
160
- else
161
- obj = Token.new(@client)
162
- obj.fill_with_data(val)
163
- @token = obj
164
- end
165
-
166
- end
167
-
168
- def token_id=(val)
169
- @token_id = val
170
- end
171
-
172
- def card=(val)
173
- if val.nil?
174
- @card = val
175
- return
176
- end
177
-
178
- if val.instance_of? Card
179
- @card = val
180
- else
181
- obj = Card.new(@client)
182
- obj.fill_with_data(val)
183
- @card = obj
184
- end
185
-
186
- end
187
-
188
- def card_id=(val)
189
- @card_id = val
190
- end
191
-
192
- def gateway_configuration=(val)
193
- if val.nil?
194
- @gateway_configuration = val
195
- return
196
- end
197
-
198
- if val.instance_of? GatewayConfiguration
199
- @gateway_configuration = val
200
- else
201
- obj = GatewayConfiguration.new(@client)
202
- obj.fill_with_data(val)
203
- @gateway_configuration = obj
204
- end
205
-
206
- end
207
-
208
- def gateway_configuration_id=(val)
209
- @gateway_configuration_id = val
210
- end
211
-
212
- def operations=(val)
213
- if val.nil?
214
- @operations = []
215
- return
216
- end
217
-
218
- if val.length > 0 and val[0].instance_of? TransactionOperation
219
- @operations = val
220
- else
221
- l = Array.new
222
- for v in val
223
- obj = TransactionOperation.new(@client)
224
- obj.fill_with_data(v)
225
- l.push(obj)
226
- end
227
- @operations = l
228
- end
229
-
230
- end
231
-
232
- def refunds=(val)
233
- if val.nil?
234
- @refunds = []
235
- return
236
- end
237
-
238
- if val.length > 0 and val[0].instance_of? Refund
239
- @refunds = val
240
- else
241
- l = Array.new
242
- for v in val
243
- obj = Refund.new(@client)
244
- obj.fill_with_data(v)
245
- l.push(obj)
246
- end
247
- @refunds = l
248
- end
249
-
250
- end
251
-
252
- def name=(val)
253
- @name = val
254
- end
255
-
256
- def amount=(val)
257
- @amount = val
258
- end
259
-
260
- def amount_local=(val)
261
- @amount_local = val
262
- end
263
-
264
- def authorized_amount=(val)
265
- @authorized_amount = val
266
- end
267
-
268
- def authorized_amount_local=(val)
269
- @authorized_amount_local = val
270
- end
271
-
272
- def captured_amount=(val)
273
- @captured_amount = val
274
- end
275
-
276
- def captured_amount_local=(val)
277
- @captured_amount_local = val
278
- end
279
-
280
- def refunded_amount=(val)
281
- @refunded_amount = val
282
- end
283
-
284
- def refunded_amount_local=(val)
285
- @refunded_amount_local = val
286
- end
287
-
288
- def available_amount=(val)
289
- @available_amount = val
290
- end
291
-
292
- def available_amount_local=(val)
293
- @available_amount_local = val
294
- end
295
-
296
- def currency=(val)
297
- @currency = val
298
- end
299
-
300
- def error_code=(val)
301
- @error_code = val
302
- end
303
-
304
- def error_message=(val)
305
- @error_message = val
306
- end
307
-
308
- def acquirer_name=(val)
309
- @acquirer_name = val
310
- end
311
-
312
- def gateway_name=(val)
313
- @gateway_name = val
314
- end
315
-
316
- def three_d_s_status=(val)
317
- @three_d_s_status = val
318
- end
319
-
320
- def status=(val)
321
- @status = val
322
- end
323
-
324
- def authorized=(val)
325
- @authorized = val
326
- end
327
-
328
- def captured=(val)
329
- @captured = val
330
- end
331
-
332
- def voided=(val)
333
- @voided = val
334
- end
335
-
336
- def refunded=(val)
337
- @refunded = val
338
- end
339
-
340
- def chargedback=(val)
341
- @chargedback = val
342
- end
343
-
344
- def received_fraud_notification=(val)
345
- @received_fraud_notification = val
346
- end
347
-
348
- def received_retrieval_request=(val)
349
- @received_retrieval_request = val
350
- end
351
-
352
- def processout_fee=(val)
353
- @processout_fee = val
354
- end
355
-
356
- def estimated_fee=(val)
357
- @estimated_fee = val
358
- end
359
-
360
- def gateway_fee=(val)
361
- @gateway_fee = val
362
- end
363
-
364
- def gateway_fee_local=(val)
365
- @gateway_fee_local = val
366
- end
367
-
368
- def currency_fee=(val)
369
- @currency_fee = val
370
- end
371
-
372
- def metadata=(val)
373
- @metadata = val
374
- end
375
-
376
- def sandbox=(val)
377
- @sandbox = val
378
- end
379
-
380
- def created_at=(val)
381
- @created_at = val
382
- end
383
-
384
- def chargedback_at=(val)
385
- @chargedback_at = val
386
- end
387
-
388
- def refunded_at=(val)
389
- @refunded_at = val
390
- end
391
-
392
- def three_d_s=(val)
393
- if val.nil?
394
- @three_d_s = val
395
- return
396
- end
397
-
398
- if val.instance_of? ThreeDS
399
- @three_d_s = val
400
- else
401
- obj = ThreeDS.new(@client)
402
- obj.fill_with_data(val)
403
- @three_d_s = obj
404
- end
405
-
406
- end
407
-
408
- def cvc_check=(val)
409
- @cvc_check = val
410
- end
411
-
412
- def avs_check=(val)
413
- @avs_check = val
414
- end
415
-
416
-
417
- # Initializes the Transaction object
418
- # Params:
419
- # +client+:: +ProcessOut+ client instance
420
- # +data+:: data that can be used to fill the object
421
- def initialize(client, data = {})
422
- @client = client
423
-
424
- self.id = data.fetch(:id, nil)
425
- self.project = data.fetch(:project, nil)
426
- self.project_id = data.fetch(:project_id, nil)
427
- self.invoice = data.fetch(:invoice, nil)
428
- self.invoice_id = data.fetch(:invoice_id, nil)
429
- self.customer = data.fetch(:customer, nil)
430
- self.customer_id = data.fetch(:customer_id, nil)
431
- self.subscription = data.fetch(:subscription, nil)
432
- self.subscription_id = data.fetch(:subscription_id, nil)
433
- self.token = data.fetch(:token, nil)
434
- self.token_id = data.fetch(:token_id, nil)
435
- self.card = data.fetch(:card, nil)
436
- self.card_id = data.fetch(:card_id, nil)
437
- self.gateway_configuration = data.fetch(:gateway_configuration, nil)
438
- self.gateway_configuration_id = data.fetch(:gateway_configuration_id, nil)
439
- self.operations = data.fetch(:operations, nil)
440
- self.refunds = data.fetch(:refunds, nil)
441
- self.name = data.fetch(:name, nil)
442
- self.amount = data.fetch(:amount, nil)
443
- self.amount_local = data.fetch(:amount_local, nil)
444
- self.authorized_amount = data.fetch(:authorized_amount, nil)
445
- self.authorized_amount_local = data.fetch(:authorized_amount_local, nil)
446
- self.captured_amount = data.fetch(:captured_amount, nil)
447
- self.captured_amount_local = data.fetch(:captured_amount_local, nil)
448
- self.refunded_amount = data.fetch(:refunded_amount, nil)
449
- self.refunded_amount_local = data.fetch(:refunded_amount_local, nil)
450
- self.available_amount = data.fetch(:available_amount, nil)
451
- self.available_amount_local = data.fetch(:available_amount_local, nil)
452
- self.currency = data.fetch(:currency, nil)
453
- self.error_code = data.fetch(:error_code, nil)
454
- self.error_message = data.fetch(:error_message, nil)
455
- self.acquirer_name = data.fetch(:acquirer_name, nil)
456
- self.gateway_name = data.fetch(:gateway_name, nil)
457
- self.three_d_s_status = data.fetch(:three_d_s_status, nil)
458
- self.status = data.fetch(:status, nil)
459
- self.authorized = data.fetch(:authorized, nil)
460
- self.captured = data.fetch(:captured, nil)
461
- self.voided = data.fetch(:voided, nil)
462
- self.refunded = data.fetch(:refunded, nil)
463
- self.chargedback = data.fetch(:chargedback, nil)
464
- self.received_fraud_notification = data.fetch(:received_fraud_notification, nil)
465
- self.received_retrieval_request = data.fetch(:received_retrieval_request, nil)
466
- self.processout_fee = data.fetch(:processout_fee, nil)
467
- self.estimated_fee = data.fetch(:estimated_fee, nil)
468
- self.gateway_fee = data.fetch(:gateway_fee, nil)
469
- self.gateway_fee_local = data.fetch(:gateway_fee_local, nil)
470
- self.currency_fee = data.fetch(:currency_fee, nil)
471
- self.metadata = data.fetch(:metadata, nil)
472
- self.sandbox = data.fetch(:sandbox, nil)
473
- self.created_at = data.fetch(:created_at, nil)
474
- self.chargedback_at = data.fetch(:chargedback_at, nil)
475
- self.refunded_at = data.fetch(:refunded_at, nil)
476
- self.three_d_s = data.fetch(:three_d_s, nil)
477
- self.cvc_check = data.fetch(:cvc_check, nil)
478
- self.avs_check = data.fetch(:avs_check, nil)
479
-
480
- end
481
-
482
- # Create a new Transaction using the current client
483
- def new(data = {})
484
- Transaction.new(@client, data)
485
- end
486
-
487
- # Overrides the JSON marshaller to only send the fields we want
488
- def to_json(options)
489
- {
490
- "id": self.id,
491
- "project": self.project,
492
- "project_id": self.project_id,
493
- "invoice": self.invoice,
494
- "invoice_id": self.invoice_id,
495
- "customer": self.customer,
496
- "customer_id": self.customer_id,
497
- "subscription": self.subscription,
498
- "subscription_id": self.subscription_id,
499
- "token": self.token,
500
- "token_id": self.token_id,
501
- "card": self.card,
502
- "card_id": self.card_id,
503
- "gateway_configuration": self.gateway_configuration,
504
- "gateway_configuration_id": self.gateway_configuration_id,
505
- "operations": self.operations,
506
- "refunds": self.refunds,
507
- "name": self.name,
508
- "amount": self.amount,
509
- "amount_local": self.amount_local,
510
- "authorized_amount": self.authorized_amount,
511
- "authorized_amount_local": self.authorized_amount_local,
512
- "captured_amount": self.captured_amount,
513
- "captured_amount_local": self.captured_amount_local,
514
- "refunded_amount": self.refunded_amount,
515
- "refunded_amount_local": self.refunded_amount_local,
516
- "available_amount": self.available_amount,
517
- "available_amount_local": self.available_amount_local,
518
- "currency": self.currency,
519
- "error_code": self.error_code,
520
- "error_message": self.error_message,
521
- "acquirer_name": self.acquirer_name,
522
- "gateway_name": self.gateway_name,
523
- "three_d_s_status": self.three_d_s_status,
524
- "status": self.status,
525
- "authorized": self.authorized,
526
- "captured": self.captured,
527
- "voided": self.voided,
528
- "refunded": self.refunded,
529
- "chargedback": self.chargedback,
530
- "received_fraud_notification": self.received_fraud_notification,
531
- "received_retrieval_request": self.received_retrieval_request,
532
- "processout_fee": self.processout_fee,
533
- "estimated_fee": self.estimated_fee,
534
- "gateway_fee": self.gateway_fee,
535
- "gateway_fee_local": self.gateway_fee_local,
536
- "currency_fee": self.currency_fee,
537
- "metadata": self.metadata,
538
- "sandbox": self.sandbox,
539
- "created_at": self.created_at,
540
- "chargedback_at": self.chargedback_at,
541
- "refunded_at": self.refunded_at,
542
- "three_d_s": self.three_d_s,
543
- "cvc_check": self.cvc_check,
544
- "avs_check": self.avs_check,
545
- }.to_json
546
- end
547
-
548
- # Fills the object with data coming from the API
549
- # Params:
550
- # +data+:: +Hash+ of data coming from the API
551
- def fill_with_data(data)
552
- if data.nil?
553
- return self
554
- end
555
- if data.include? "id"
556
- self.id = data["id"]
557
- end
558
- if data.include? "project"
559
- self.project = data["project"]
560
- end
561
- if data.include? "project_id"
562
- self.project_id = data["project_id"]
563
- end
564
- if data.include? "invoice"
565
- self.invoice = data["invoice"]
566
- end
567
- if data.include? "invoice_id"
568
- self.invoice_id = data["invoice_id"]
569
- end
570
- if data.include? "customer"
571
- self.customer = data["customer"]
572
- end
573
- if data.include? "customer_id"
574
- self.customer_id = data["customer_id"]
575
- end
576
- if data.include? "subscription"
577
- self.subscription = data["subscription"]
578
- end
579
- if data.include? "subscription_id"
580
- self.subscription_id = data["subscription_id"]
581
- end
582
- if data.include? "token"
583
- self.token = data["token"]
584
- end
585
- if data.include? "token_id"
586
- self.token_id = data["token_id"]
587
- end
588
- if data.include? "card"
589
- self.card = data["card"]
590
- end
591
- if data.include? "card_id"
592
- self.card_id = data["card_id"]
593
- end
594
- if data.include? "gateway_configuration"
595
- self.gateway_configuration = data["gateway_configuration"]
596
- end
597
- if data.include? "gateway_configuration_id"
598
- self.gateway_configuration_id = data["gateway_configuration_id"]
599
- end
600
- if data.include? "operations"
601
- self.operations = data["operations"]
602
- end
603
- if data.include? "refunds"
604
- self.refunds = data["refunds"]
605
- end
606
- if data.include? "name"
607
- self.name = data["name"]
608
- end
609
- if data.include? "amount"
610
- self.amount = data["amount"]
611
- end
612
- if data.include? "amount_local"
613
- self.amount_local = data["amount_local"]
614
- end
615
- if data.include? "authorized_amount"
616
- self.authorized_amount = data["authorized_amount"]
617
- end
618
- if data.include? "authorized_amount_local"
619
- self.authorized_amount_local = data["authorized_amount_local"]
620
- end
621
- if data.include? "captured_amount"
622
- self.captured_amount = data["captured_amount"]
623
- end
624
- if data.include? "captured_amount_local"
625
- self.captured_amount_local = data["captured_amount_local"]
626
- end
627
- if data.include? "refunded_amount"
628
- self.refunded_amount = data["refunded_amount"]
629
- end
630
- if data.include? "refunded_amount_local"
631
- self.refunded_amount_local = data["refunded_amount_local"]
632
- end
633
- if data.include? "available_amount"
634
- self.available_amount = data["available_amount"]
635
- end
636
- if data.include? "available_amount_local"
637
- self.available_amount_local = data["available_amount_local"]
638
- end
639
- if data.include? "currency"
640
- self.currency = data["currency"]
641
- end
642
- if data.include? "error_code"
643
- self.error_code = data["error_code"]
644
- end
645
- if data.include? "error_message"
646
- self.error_message = data["error_message"]
647
- end
648
- if data.include? "acquirer_name"
649
- self.acquirer_name = data["acquirer_name"]
650
- end
651
- if data.include? "gateway_name"
652
- self.gateway_name = data["gateway_name"]
653
- end
654
- if data.include? "three_d_s_status"
655
- self.three_d_s_status = data["three_d_s_status"]
656
- end
657
- if data.include? "status"
658
- self.status = data["status"]
659
- end
660
- if data.include? "authorized"
661
- self.authorized = data["authorized"]
662
- end
663
- if data.include? "captured"
664
- self.captured = data["captured"]
665
- end
666
- if data.include? "voided"
667
- self.voided = data["voided"]
668
- end
669
- if data.include? "refunded"
670
- self.refunded = data["refunded"]
671
- end
672
- if data.include? "chargedback"
673
- self.chargedback = data["chargedback"]
674
- end
675
- if data.include? "received_fraud_notification"
676
- self.received_fraud_notification = data["received_fraud_notification"]
677
- end
678
- if data.include? "received_retrieval_request"
679
- self.received_retrieval_request = data["received_retrieval_request"]
680
- end
681
- if data.include? "processout_fee"
682
- self.processout_fee = data["processout_fee"]
683
- end
684
- if data.include? "estimated_fee"
685
- self.estimated_fee = data["estimated_fee"]
686
- end
687
- if data.include? "gateway_fee"
688
- self.gateway_fee = data["gateway_fee"]
689
- end
690
- if data.include? "gateway_fee_local"
691
- self.gateway_fee_local = data["gateway_fee_local"]
692
- end
693
- if data.include? "currency_fee"
694
- self.currency_fee = data["currency_fee"]
695
- end
696
- if data.include? "metadata"
697
- self.metadata = data["metadata"]
698
- end
699
- if data.include? "sandbox"
700
- self.sandbox = data["sandbox"]
701
- end
702
- if data.include? "created_at"
703
- self.created_at = data["created_at"]
704
- end
705
- if data.include? "chargedback_at"
706
- self.chargedback_at = data["chargedback_at"]
707
- end
708
- if data.include? "refunded_at"
709
- self.refunded_at = data["refunded_at"]
710
- end
711
- if data.include? "three_d_s"
712
- self.three_d_s = data["three_d_s"]
713
- end
714
- if data.include? "cvc_check"
715
- self.cvc_check = data["cvc_check"]
716
- end
717
- if data.include? "avs_check"
718
- self.avs_check = data["avs_check"]
719
- end
720
-
721
- self
722
- end
723
-
724
- # Prefills the object with the data passed as parameters
725
- # Params:
726
- # +data+:: +Hash+ of data
727
- def prefill(data)
728
- if data.nil?
729
- return self
730
- end
731
- self.id = data.fetch(:id, self.id)
732
- self.project = data.fetch(:project, self.project)
733
- self.project_id = data.fetch(:project_id, self.project_id)
734
- self.invoice = data.fetch(:invoice, self.invoice)
735
- self.invoice_id = data.fetch(:invoice_id, self.invoice_id)
736
- self.customer = data.fetch(:customer, self.customer)
737
- self.customer_id = data.fetch(:customer_id, self.customer_id)
738
- self.subscription = data.fetch(:subscription, self.subscription)
739
- self.subscription_id = data.fetch(:subscription_id, self.subscription_id)
740
- self.token = data.fetch(:token, self.token)
741
- self.token_id = data.fetch(:token_id, self.token_id)
742
- self.card = data.fetch(:card, self.card)
743
- self.card_id = data.fetch(:card_id, self.card_id)
744
- self.gateway_configuration = data.fetch(:gateway_configuration, self.gateway_configuration)
745
- self.gateway_configuration_id = data.fetch(:gateway_configuration_id, self.gateway_configuration_id)
746
- self.operations = data.fetch(:operations, self.operations)
747
- self.refunds = data.fetch(:refunds, self.refunds)
748
- self.name = data.fetch(:name, self.name)
749
- self.amount = data.fetch(:amount, self.amount)
750
- self.amount_local = data.fetch(:amount_local, self.amount_local)
751
- self.authorized_amount = data.fetch(:authorized_amount, self.authorized_amount)
752
- self.authorized_amount_local = data.fetch(:authorized_amount_local, self.authorized_amount_local)
753
- self.captured_amount = data.fetch(:captured_amount, self.captured_amount)
754
- self.captured_amount_local = data.fetch(:captured_amount_local, self.captured_amount_local)
755
- self.refunded_amount = data.fetch(:refunded_amount, self.refunded_amount)
756
- self.refunded_amount_local = data.fetch(:refunded_amount_local, self.refunded_amount_local)
757
- self.available_amount = data.fetch(:available_amount, self.available_amount)
758
- self.available_amount_local = data.fetch(:available_amount_local, self.available_amount_local)
759
- self.currency = data.fetch(:currency, self.currency)
760
- self.error_code = data.fetch(:error_code, self.error_code)
761
- self.error_message = data.fetch(:error_message, self.error_message)
762
- self.acquirer_name = data.fetch(:acquirer_name, self.acquirer_name)
763
- self.gateway_name = data.fetch(:gateway_name, self.gateway_name)
764
- self.three_d_s_status = data.fetch(:three_d_s_status, self.three_d_s_status)
765
- self.status = data.fetch(:status, self.status)
766
- self.authorized = data.fetch(:authorized, self.authorized)
767
- self.captured = data.fetch(:captured, self.captured)
768
- self.voided = data.fetch(:voided, self.voided)
769
- self.refunded = data.fetch(:refunded, self.refunded)
770
- self.chargedback = data.fetch(:chargedback, self.chargedback)
771
- self.received_fraud_notification = data.fetch(:received_fraud_notification, self.received_fraud_notification)
772
- self.received_retrieval_request = data.fetch(:received_retrieval_request, self.received_retrieval_request)
773
- self.processout_fee = data.fetch(:processout_fee, self.processout_fee)
774
- self.estimated_fee = data.fetch(:estimated_fee, self.estimated_fee)
775
- self.gateway_fee = data.fetch(:gateway_fee, self.gateway_fee)
776
- self.gateway_fee_local = data.fetch(:gateway_fee_local, self.gateway_fee_local)
777
- self.currency_fee = data.fetch(:currency_fee, self.currency_fee)
778
- self.metadata = data.fetch(:metadata, self.metadata)
779
- self.sandbox = data.fetch(:sandbox, self.sandbox)
780
- self.created_at = data.fetch(:created_at, self.created_at)
781
- self.chargedback_at = data.fetch(:chargedback_at, self.chargedback_at)
782
- self.refunded_at = data.fetch(:refunded_at, self.refunded_at)
783
- self.three_d_s = data.fetch(:three_d_s, self.three_d_s)
784
- self.cvc_check = data.fetch(:cvc_check, self.cvc_check)
785
- self.avs_check = data.fetch(:avs_check, self.avs_check)
786
-
787
- self
788
- end
789
-
790
- # Get the transaction's refunds.
791
- # Params:
792
- # +options+:: +Hash+ of options
793
- def fetch_refunds(options = {})
794
- self.prefill(options)
795
-
796
- request = Request.new(@client)
797
- path = "/transactions/" + CGI.escape(@id) + "/refunds"
798
- data = {
799
-
800
- }
801
-
802
- response = Response.new(request.get(path, data, options))
803
- return_values = Array.new
804
-
805
- a = Array.new
806
- body = response.body
807
- for v in body['refunds']
808
- tmp = Refund.new(@client)
809
- tmp.fill_with_data(v)
810
- a.push(tmp)
811
- end
812
-
813
- return_values.push(a)
814
-
815
-
816
-
817
- return_values[0]
818
- end
819
-
820
- # Find a transaction's refund by its ID.
821
- # Params:
822
- # +refund_id+:: ID of the refund
823
- # +options+:: +Hash+ of options
824
- def find_refund(refund_id, options = {})
825
- self.prefill(options)
826
-
827
- request = Request.new(@client)
828
- path = "/transactions/" + CGI.escape(@id) + "/refunds/" + CGI.escape(refund_id) + ""
829
- data = {
830
-
831
- }
832
-
833
- response = Response.new(request.get(path, data, options))
834
- return_values = Array.new
835
-
836
- body = response.body
837
- body = body["refund"]
838
- refund = Refund.new(@client)
839
- return_values.push(refund.fill_with_data(body))
840
-
841
-
842
- return_values[0]
843
- end
844
-
845
- # Get all the transactions.
846
- # Params:
847
- # +options+:: +Hash+ of options
848
- def all(options = {})
849
- self.prefill(options)
850
-
851
- request = Request.new(@client)
852
- path = "/transactions"
853
- data = {
854
-
855
- }
856
-
857
- response = Response.new(request.get(path, data, options))
858
- return_values = Array.new
859
-
860
- a = Array.new
861
- body = response.body
862
- for v in body['transactions']
863
- tmp = Transaction.new(@client)
864
- tmp.fill_with_data(v)
865
- a.push(tmp)
866
- end
867
-
868
- return_values.push(a)
869
-
870
-
871
-
872
- return_values[0]
873
- end
874
-
875
- # Find a transaction by its ID.
876
- # Params:
877
- # +transaction_id+:: ID of the transaction
878
- # +options+:: +Hash+ of options
879
- def find(transaction_id, options = {})
880
- self.prefill(options)
881
-
882
- request = Request.new(@client)
883
- path = "/transactions/" + CGI.escape(transaction_id) + ""
884
- data = {
885
-
886
- }
887
-
888
- response = Response.new(request.get(path, data, options))
889
- return_values = Array.new
890
-
891
- body = response.body
892
- body = body["transaction"]
893
-
894
-
895
- obj = Transaction.new(@client)
896
- return_values.push(obj.fill_with_data(body))
897
-
898
-
899
-
900
- return_values[0]
901
- end
902
-
903
-
904
- end
905
- end