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