Class: ProcessOut::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/processout/transaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, data = {}) ⇒ Transaction

Initializes the Transaction object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/processout/transaction.rb', line 506

def initialize(client, data = {})
  @client = client

  self.id = data.fetch(:id, nil)
  self.project = data.fetch(:project, nil)
  self.project_id = data.fetch(:project_id, nil)
  self.invoice = data.fetch(:invoice, nil)
  self.invoice_id = data.fetch(:invoice_id, nil)
  self.customer = data.fetch(:customer, nil)
  self.customer_id = data.fetch(:customer_id, nil)
  self.subscription = data.fetch(:subscription, nil)
  self.subscription_id = data.fetch(:subscription_id, nil)
  self.token = data.fetch(:token, nil)
  self.token_id = data.fetch(:token_id, nil)
  self.card = data.fetch(:card, nil)
  self.card_id = data.fetch(:card_id, nil)
  self.gateway_configuration = data.fetch(:gateway_configuration, nil)
  self.external_three_d_s_gateway_configuration = data.fetch(:external_three_d_s_gateway_configuration, nil)
  self.gateway_configuration_id = data.fetch(:gateway_configuration_id, nil)
  self.operations = data.fetch(:operations, nil)
  self.refunds = data.fetch(:refunds, nil)
  self.name = data.fetch(:name, nil)
  self.amount = data.fetch(:amount, nil)
  self.amount_local = data.fetch(:amount_local, nil)
  self.authorized_amount = data.fetch(:authorized_amount, nil)
  self.authorized_amount_local = data.fetch(:authorized_amount_local, nil)
  self.captured_amount = data.fetch(:captured_amount, nil)
  self.captured_amount_local = data.fetch(:captured_amount_local, nil)
  self.refunded_amount = data.fetch(:refunded_amount, nil)
  self.refunded_amount_local = data.fetch(:refunded_amount_local, nil)
  self.available_amount = data.fetch(:available_amount, nil)
  self.available_amount_local = data.fetch(:available_amount_local, nil)
  self.voided_amount = data.fetch(:voided_amount, nil)
  self.voided_amount_local = data.fetch(:voided_amount_local, nil)
  self.currency = data.fetch(:currency, nil)
  self.error_code = data.fetch(:error_code, nil)
  self.error_message = data.fetch(:error_message, nil)
  self.acquirer_name = data.fetch(:acquirer_name, nil)
  self.gateway_name = data.fetch(:gateway_name, nil)
  self.three_d_s_status = data.fetch(:three_d_s_status, nil)
  self.status = data.fetch(:status, nil)
  self.authorized = data.fetch(:authorized, nil)
  self.captured = data.fetch(:captured, nil)
  self.voided = data.fetch(:voided, nil)
  self.refunded = data.fetch(:refunded, nil)
  self.chargedback = data.fetch(:chargedback, nil)
  self.received_fraud_notification = data.fetch(:received_fraud_notification, nil)
  self.received_retrieval_request = data.fetch(:received_retrieval_request, nil)
  self.processout_fee = data.fetch(:processout_fee, nil)
  self.estimated_fee = data.fetch(:estimated_fee, nil)
  self.gateway_fee = data.fetch(:gateway_fee, nil)
  self.gateway_fee_local = data.fetch(:gateway_fee_local, nil)
  self.currency_fee = data.fetch(:currency_fee, nil)
  self. = data.fetch(:metadata, nil)
  self.sandbox = data.fetch(:sandbox, nil)
  self.created_at = data.fetch(:created_at, nil)
  self.chargedback_at = data.fetch(:chargedback_at, nil)
  self.refunded_at = data.fetch(:refunded_at, nil)
  self.authorized_at = data.fetch(:authorized_at, nil)
  self.captured_at = data.fetch(:captured_at, nil)
  self.voided_at = data.fetch(:voided_at, nil)
  self.three_d_s = data.fetch(:three_d_s, nil)
  self.cvc_check = data.fetch(:cvc_check, nil)
  self.avs_check = data.fetch(:avs_check, nil)
  self.initial_scheme_transaction_id = data.fetch(:initial_scheme_transaction_id, nil)
  self.scheme_id = data.fetch(:scheme_id, nil)
  self.payment_type = data.fetch(:payment_type, nil)
  self.eci = data.fetch(:eci, nil)
  self.native_apm = data.fetch(:native_apm, nil)
  self.external_details = data.fetch(:external_details, nil)
  
end

Instance Attribute Details

#acquirer_nameObject

Returns the value of attribute acquirer_name.



45
46
47
# File 'lib/processout/transaction.rb', line 45

def acquirer_name
  @acquirer_name
end

#amountObject

Returns the value of attribute amount.



30
31
32
# File 'lib/processout/transaction.rb', line 30

def amount
  @amount
end

#amount_localObject

Returns the value of attribute amount_local.



31
32
33
# File 'lib/processout/transaction.rb', line 31

def amount_local
  @amount_local
end

#authorizedObject

Returns the value of attribute authorized.



49
50
51
# File 'lib/processout/transaction.rb', line 49

def authorized
  @authorized
end

#authorized_amountObject

Returns the value of attribute authorized_amount.



32
33
34
# File 'lib/processout/transaction.rb', line 32

def authorized_amount
  @authorized_amount
end

#authorized_amount_localObject

Returns the value of attribute authorized_amount_local.



33
34
35
# File 'lib/processout/transaction.rb', line 33

def authorized_amount_local
  @authorized_amount_local
end

#authorized_atObject

Returns the value of attribute authorized_at.



66
67
68
# File 'lib/processout/transaction.rb', line 66

def authorized_at
  @authorized_at
end

#available_amountObject

Returns the value of attribute available_amount.



38
39
40
# File 'lib/processout/transaction.rb', line 38

def available_amount
  @available_amount
end

#available_amount_localObject

Returns the value of attribute available_amount_local.



39
40
41
# File 'lib/processout/transaction.rb', line 39

def available_amount_local
  @available_amount_local
end

#avs_checkObject

Returns the value of attribute avs_check.



71
72
73
# File 'lib/processout/transaction.rb', line 71

def avs_check
  @avs_check
end

#capturedObject

Returns the value of attribute captured.



50
51
52
# File 'lib/processout/transaction.rb', line 50

def captured
  @captured
end

#captured_amountObject

Returns the value of attribute captured_amount.



34
35
36
# File 'lib/processout/transaction.rb', line 34

def captured_amount
  @captured_amount
end

#captured_amount_localObject

Returns the value of attribute captured_amount_local.



35
36
37
# File 'lib/processout/transaction.rb', line 35

def captured_amount_local
  @captured_amount_local
end

#captured_atObject

Returns the value of attribute captured_at.



67
68
69
# File 'lib/processout/transaction.rb', line 67

def captured_at
  @captured_at
end

#cardObject

Returns the value of attribute card.



22
23
24
# File 'lib/processout/transaction.rb', line 22

def card
  @card
end

#card_idObject

Returns the value of attribute card_id.



23
24
25
# File 'lib/processout/transaction.rb', line 23

def card_id
  @card_id
end

#chargedbackObject

Returns the value of attribute chargedback.



53
54
55
# File 'lib/processout/transaction.rb', line 53

def chargedback
  @chargedback
end

#chargedback_atObject

Returns the value of attribute chargedback_at.



64
65
66
# File 'lib/processout/transaction.rb', line 64

def chargedback_at
  @chargedback_at
end

#created_atObject

Returns the value of attribute created_at.



63
64
65
# File 'lib/processout/transaction.rb', line 63

def created_at
  @created_at
end

#currencyObject

Returns the value of attribute currency.



42
43
44
# File 'lib/processout/transaction.rb', line 42

def currency
  @currency
end

#currency_feeObject

Returns the value of attribute currency_fee.



60
61
62
# File 'lib/processout/transaction.rb', line 60

def currency_fee
  @currency_fee
end

#customerObject

Returns the value of attribute customer.



16
17
18
# File 'lib/processout/transaction.rb', line 16

def customer
  @customer
end

#customer_idObject

Returns the value of attribute customer_id.



17
18
19
# File 'lib/processout/transaction.rb', line 17

def customer_id
  @customer_id
end

#cvc_checkObject

Returns the value of attribute cvc_check.



70
71
72
# File 'lib/processout/transaction.rb', line 70

def cvc_check
  @cvc_check
end

#eciObject

Returns the value of attribute eci.



75
76
77
# File 'lib/processout/transaction.rb', line 75

def eci
  @eci
end

#error_codeObject

Returns the value of attribute error_code.



43
44
45
# File 'lib/processout/transaction.rb', line 43

def error_code
  @error_code
end

#error_messageObject

Returns the value of attribute error_message.



44
45
46
# File 'lib/processout/transaction.rb', line 44

def error_message
  @error_message
end

#estimated_feeObject

Returns the value of attribute estimated_fee.



57
58
59
# File 'lib/processout/transaction.rb', line 57

def estimated_fee
  @estimated_fee
end

#external_detailsObject

Returns the value of attribute external_details.



77
78
79
# File 'lib/processout/transaction.rb', line 77

def external_details
  @external_details
end

#external_three_d_s_gateway_configurationObject

Returns the value of attribute external_three_d_s_gateway_configuration.



25
26
27
# File 'lib/processout/transaction.rb', line 25

def external_three_d_s_gateway_configuration
  @external_three_d_s_gateway_configuration
end

#gateway_configurationObject

Returns the value of attribute gateway_configuration.



24
25
26
# File 'lib/processout/transaction.rb', line 24

def gateway_configuration
  @gateway_configuration
end

#gateway_configuration_idObject

Returns the value of attribute gateway_configuration_id.



26
27
28
# File 'lib/processout/transaction.rb', line 26

def gateway_configuration_id
  @gateway_configuration_id
end

#gateway_feeObject

Returns the value of attribute gateway_fee.



58
59
60
# File 'lib/processout/transaction.rb', line 58

def gateway_fee
  @gateway_fee
end

#gateway_fee_localObject

Returns the value of attribute gateway_fee_local.



59
60
61
# File 'lib/processout/transaction.rb', line 59

def gateway_fee_local
  @gateway_fee_local
end

#gateway_nameObject

Returns the value of attribute gateway_name.



46
47
48
# File 'lib/processout/transaction.rb', line 46

def gateway_name
  @gateway_name
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/processout/transaction.rb', line 11

def id
  @id
end

#initial_scheme_transaction_idObject

Returns the value of attribute initial_scheme_transaction_id.



72
73
74
# File 'lib/processout/transaction.rb', line 72

def initial_scheme_transaction_id
  @initial_scheme_transaction_id
end

#invoiceObject

Returns the value of attribute invoice.



14
15
16
# File 'lib/processout/transaction.rb', line 14

def invoice
  @invoice
end

#invoice_idObject

Returns the value of attribute invoice_id.



15
16
17
# File 'lib/processout/transaction.rb', line 15

def invoice_id
  @invoice_id
end

#metadataObject

Returns the value of attribute metadata.



61
62
63
# File 'lib/processout/transaction.rb', line 61

def 
  @metadata
end

#nameObject

Returns the value of attribute name.



29
30
31
# File 'lib/processout/transaction.rb', line 29

def name
  @name
end

#native_apmObject

Returns the value of attribute native_apm.



76
77
78
# File 'lib/processout/transaction.rb', line 76

def native_apm
  @native_apm
end

#operationsObject

Returns the value of attribute operations.



27
28
29
# File 'lib/processout/transaction.rb', line 27

def operations
  @operations
end

#payment_typeObject

Returns the value of attribute payment_type.



74
75
76
# File 'lib/processout/transaction.rb', line 74

def payment_type
  @payment_type
end

#processout_feeObject

Returns the value of attribute processout_fee.



56
57
58
# File 'lib/processout/transaction.rb', line 56

def processout_fee
  @processout_fee
end

#projectObject

Returns the value of attribute project.



12
13
14
# File 'lib/processout/transaction.rb', line 12

def project
  @project
end

#project_idObject

Returns the value of attribute project_id.



13
14
15
# File 'lib/processout/transaction.rb', line 13

def project_id
  @project_id
end

#received_fraud_notificationObject

Returns the value of attribute received_fraud_notification.



54
55
56
# File 'lib/processout/transaction.rb', line 54

def received_fraud_notification
  @received_fraud_notification
end

#received_retrieval_requestObject

Returns the value of attribute received_retrieval_request.



55
56
57
# File 'lib/processout/transaction.rb', line 55

def received_retrieval_request
  @received_retrieval_request
end

#refundedObject

Returns the value of attribute refunded.



52
53
54
# File 'lib/processout/transaction.rb', line 52

def refunded
  @refunded
end

#refunded_amountObject

Returns the value of attribute refunded_amount.



36
37
38
# File 'lib/processout/transaction.rb', line 36

def refunded_amount
  @refunded_amount
end

#refunded_amount_localObject

Returns the value of attribute refunded_amount_local.



37
38
39
# File 'lib/processout/transaction.rb', line 37

def refunded_amount_local
  @refunded_amount_local
end

#refunded_atObject

Returns the value of attribute refunded_at.



65
66
67
# File 'lib/processout/transaction.rb', line 65

def refunded_at
  @refunded_at
end

#refundsObject

Returns the value of attribute refunds.



28
29
30
# File 'lib/processout/transaction.rb', line 28

def refunds
  @refunds
end

#sandboxObject

Returns the value of attribute sandbox.



62
63
64
# File 'lib/processout/transaction.rb', line 62

def sandbox
  @sandbox
end

#scheme_idObject

Returns the value of attribute scheme_id.



73
74
75
# File 'lib/processout/transaction.rb', line 73

def scheme_id
  @scheme_id
end

#statusObject

Returns the value of attribute status.



48
49
50
# File 'lib/processout/transaction.rb', line 48

def status
  @status
end

#subscriptionObject

Returns the value of attribute subscription.



18
19
20
# File 'lib/processout/transaction.rb', line 18

def subscription
  @subscription
end

#subscription_idObject

Returns the value of attribute subscription_id.



19
20
21
# File 'lib/processout/transaction.rb', line 19

def subscription_id
  @subscription_id
end

#three_d_sObject

Returns the value of attribute three_d_s.



69
70
71
# File 'lib/processout/transaction.rb', line 69

def three_d_s
  @three_d_s
end

#three_d_s_statusObject

Returns the value of attribute three_d_s_status.



47
48
49
# File 'lib/processout/transaction.rb', line 47

def three_d_s_status
  @three_d_s_status
end

#tokenObject

Returns the value of attribute token.



20
21
22
# File 'lib/processout/transaction.rb', line 20

def token
  @token
end

#token_idObject

Returns the value of attribute token_id.



21
22
23
# File 'lib/processout/transaction.rb', line 21

def token_id
  @token_id
end

#voidedObject

Returns the value of attribute voided.



51
52
53
# File 'lib/processout/transaction.rb', line 51

def voided
  @voided
end

#voided_amountObject

Returns the value of attribute voided_amount.



40
41
42
# File 'lib/processout/transaction.rb', line 40

def voided_amount
  @voided_amount
end

#voided_amount_localObject

Returns the value of attribute voided_amount_local.



41
42
43
# File 'lib/processout/transaction.rb', line 41

def voided_amount_local
  @voided_amount_local
end

#voided_atObject

Returns the value of attribute voided_at.



68
69
70
# File 'lib/processout/transaction.rb', line 68

def voided_at
  @voided_at
end

Instance Method Details

#all(options = {}) ⇒ Object

Get all the transactions. Params:

options

Hash of options



1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
# File 'lib/processout/transaction.rb', line 1005

def all(options = {})
  self.prefill(options)

  request = Request.new(@client)
  path    = "/transactions"
  data    = {

  }

  response = Response.new(request.get(path, data, options))
  return_values = Array.new
  
  a    = Array.new
  body = response.body
  for v in body['transactions']
    tmp = Transaction.new(@client)
    tmp.fill_with_data(v)
    a.push(tmp)
  end

  return_values.push(a)
  

  
  return_values[0]
end

#fetch_refunds(options = {}) ⇒ Object

Get the transaction’s refunds. Params:

options

Hash of options



950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
# File 'lib/processout/transaction.rb', line 950

def fetch_refunds(options = {})
  self.prefill(options)

  request = Request.new(@client)
  path    = "/transactions/" + CGI.escape(@id) + "/refunds"
  data    = {

  }

  response = Response.new(request.get(path, data, options))
  return_values = Array.new
  
  a    = Array.new
  body = response.body
  for v in body['refunds']
    tmp = Refund.new(@client)
    tmp.fill_with_data(v)
    a.push(tmp)
  end

  return_values.push(a)
  

  
  return_values[0]
end

#fill_with_data(data) ⇒ Object

Fills the object with data coming from the API Params:

data

Hash of data coming from the API



660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
# File 'lib/processout/transaction.rb', line 660

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "id"
    self.id = data["id"]
  end
  if data.include? "project"
    self.project = data["project"]
  end
  if data.include? "project_id"
    self.project_id = data["project_id"]
  end
  if data.include? "invoice"
    self.invoice = data["invoice"]
  end
  if data.include? "invoice_id"
    self.invoice_id = data["invoice_id"]
  end
  if data.include? "customer"
    self.customer = data["customer"]
  end
  if data.include? "customer_id"
    self.customer_id = data["customer_id"]
  end
  if data.include? "subscription"
    self.subscription = data["subscription"]
  end
  if data.include? "subscription_id"
    self.subscription_id = data["subscription_id"]
  end
  if data.include? "token"
    self.token = data["token"]
  end
  if data.include? "token_id"
    self.token_id = data["token_id"]
  end
  if data.include? "card"
    self.card = data["card"]
  end
  if data.include? "card_id"
    self.card_id = data["card_id"]
  end
  if data.include? "gateway_configuration"
    self.gateway_configuration = data["gateway_configuration"]
  end
  if data.include? "external_three_d_s_gateway_configuration"
    self.external_three_d_s_gateway_configuration = data["external_three_d_s_gateway_configuration"]
  end
  if data.include? "gateway_configuration_id"
    self.gateway_configuration_id = data["gateway_configuration_id"]
  end
  if data.include? "operations"
    self.operations = data["operations"]
  end
  if data.include? "refunds"
    self.refunds = data["refunds"]
  end
  if data.include? "name"
    self.name = data["name"]
  end
  if data.include? "amount"
    self.amount = data["amount"]
  end
  if data.include? "amount_local"
    self.amount_local = data["amount_local"]
  end
  if data.include? "authorized_amount"
    self.authorized_amount = data["authorized_amount"]
  end
  if data.include? "authorized_amount_local"
    self.authorized_amount_local = data["authorized_amount_local"]
  end
  if data.include? "captured_amount"
    self.captured_amount = data["captured_amount"]
  end
  if data.include? "captured_amount_local"
    self.captured_amount_local = data["captured_amount_local"]
  end
  if data.include? "refunded_amount"
    self.refunded_amount = data["refunded_amount"]
  end
  if data.include? "refunded_amount_local"
    self.refunded_amount_local = data["refunded_amount_local"]
  end
  if data.include? "available_amount"
    self.available_amount = data["available_amount"]
  end
  if data.include? "available_amount_local"
    self.available_amount_local = data["available_amount_local"]
  end
  if data.include? "voided_amount"
    self.voided_amount = data["voided_amount"]
  end
  if data.include? "voided_amount_local"
    self.voided_amount_local = data["voided_amount_local"]
  end
  if data.include? "currency"
    self.currency = data["currency"]
  end
  if data.include? "error_code"
    self.error_code = data["error_code"]
  end
  if data.include? "error_message"
    self.error_message = data["error_message"]
  end
  if data.include? "acquirer_name"
    self.acquirer_name = data["acquirer_name"]
  end
  if data.include? "gateway_name"
    self.gateway_name = data["gateway_name"]
  end
  if data.include? "three_d_s_status"
    self.three_d_s_status = data["three_d_s_status"]
  end
  if data.include? "status"
    self.status = data["status"]
  end
  if data.include? "authorized"
    self.authorized = data["authorized"]
  end
  if data.include? "captured"
    self.captured = data["captured"]
  end
  if data.include? "voided"
    self.voided = data["voided"]
  end
  if data.include? "refunded"
    self.refunded = data["refunded"]
  end
  if data.include? "chargedback"
    self.chargedback = data["chargedback"]
  end
  if data.include? "received_fraud_notification"
    self.received_fraud_notification = data["received_fraud_notification"]
  end
  if data.include? "received_retrieval_request"
    self.received_retrieval_request = data["received_retrieval_request"]
  end
  if data.include? "processout_fee"
    self.processout_fee = data["processout_fee"]
  end
  if data.include? "estimated_fee"
    self.estimated_fee = data["estimated_fee"]
  end
  if data.include? "gateway_fee"
    self.gateway_fee = data["gateway_fee"]
  end
  if data.include? "gateway_fee_local"
    self.gateway_fee_local = data["gateway_fee_local"]
  end
  if data.include? "currency_fee"
    self.currency_fee = data["currency_fee"]
  end
  if data.include? "metadata"
    self. = data["metadata"]
  end
  if data.include? "sandbox"
    self.sandbox = data["sandbox"]
  end
  if data.include? "created_at"
    self.created_at = data["created_at"]
  end
  if data.include? "chargedback_at"
    self.chargedback_at = data["chargedback_at"]
  end
  if data.include? "refunded_at"
    self.refunded_at = data["refunded_at"]
  end
  if data.include? "authorized_at"
    self.authorized_at = data["authorized_at"]
  end
  if data.include? "captured_at"
    self.captured_at = data["captured_at"]
  end
  if data.include? "voided_at"
    self.voided_at = data["voided_at"]
  end
  if data.include? "three_d_s"
    self.three_d_s = data["three_d_s"]
  end
  if data.include? "cvc_check"
    self.cvc_check = data["cvc_check"]
  end
  if data.include? "avs_check"
    self.avs_check = data["avs_check"]
  end
  if data.include? "initial_scheme_transaction_id"
    self.initial_scheme_transaction_id = data["initial_scheme_transaction_id"]
  end
  if data.include? "scheme_id"
    self.scheme_id = data["scheme_id"]
  end
  if data.include? "payment_type"
    self.payment_type = data["payment_type"]
  end
  if data.include? "eci"
    self.eci = data["eci"]
  end
  if data.include? "native_apm"
    self.native_apm = data["native_apm"]
  end
  if data.include? "external_details"
    self.external_details = data["external_details"]
  end
  
  self
end

#find(transaction_id, options = {}) ⇒ Object

Find a transaction by its ID. Params:

transaction_id

ID of the transaction

options

Hash of options



1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
# File 'lib/processout/transaction.rb', line 1066

def find(transaction_id, options = {})
  self.prefill(options)

  request = Request.new(@client)
  path    = "/transactions/" + CGI.escape(transaction_id) + ""
  data    = {

  }

  response = Response.new(request.get(path, data, options))
  return_values = Array.new
  
  body = response.body
  body = body["transaction"]
  
  
  obj = Transaction.new(@client)
  return_values.push(obj.fill_with_data(body))
  

  
  return_values[0]
end

#find_refund(refund_id, options = {}) ⇒ Object

Find a transaction’s refund by its ID. Params:

refund_id

ID of the refund

options

Hash of options



981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# File 'lib/processout/transaction.rb', line 981

def find_refund(refund_id, options = {})
  self.prefill(options)

  request = Request.new(@client)
  path    = "/transactions/" + CGI.escape(@id) + "/refunds/" + CGI.escape(refund_id) + ""
  data    = {

  }

  response = Response.new(request.get(path, data, options))
  return_values = Array.new
  
  body = response.body
  body = body["refund"]
  refund = Refund.new(@client)
  return_values.push(refund.fill_with_data(body))

  
  return_values[0]
end

#list(options = {}) ⇒ Object

Get full transactions data for specified list of ids. Params:

options

Hash of options



1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
# File 'lib/processout/transaction.rb', line 1035

def list(options = {})
  self.prefill(options)

  request = Request.new(@client)
  path    = "/transactions"
  data    = {

  }

  response = Response.new(request.post(path, data, options))
  return_values = Array.new
  
  a    = Array.new
  body = response.body
  for v in body['transactions']
    tmp = Transaction.new(@client)
    tmp.fill_with_data(v)
    a.push(tmp)
  end

  return_values.push(a)
  

  
  return_values[0]
end

#new(data = {}) ⇒ Object

Create a new Transaction using the current client



580
581
582
# File 'lib/processout/transaction.rb', line 580

def new(data = {})
  Transaction.new(@client, data)
end

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
# File 'lib/processout/transaction.rb', line 872

def prefill(data)
  if data.nil?
    return self
  end
  self.id = data.fetch(:id, self.id)
  self.project = data.fetch(:project, self.project)
  self.project_id = data.fetch(:project_id, self.project_id)
  self.invoice = data.fetch(:invoice, self.invoice)
  self.invoice_id = data.fetch(:invoice_id, self.invoice_id)
  self.customer = data.fetch(:customer, self.customer)
  self.customer_id = data.fetch(:customer_id, self.customer_id)
  self.subscription = data.fetch(:subscription, self.subscription)
  self.subscription_id = data.fetch(:subscription_id, self.subscription_id)
  self.token = data.fetch(:token, self.token)
  self.token_id = data.fetch(:token_id, self.token_id)
  self.card = data.fetch(:card, self.card)
  self.card_id = data.fetch(:card_id, self.card_id)
  self.gateway_configuration = data.fetch(:gateway_configuration, self.gateway_configuration)
  self.external_three_d_s_gateway_configuration = data.fetch(:external_three_d_s_gateway_configuration, self.external_three_d_s_gateway_configuration)
  self.gateway_configuration_id = data.fetch(:gateway_configuration_id, self.gateway_configuration_id)
  self.operations = data.fetch(:operations, self.operations)
  self.refunds = data.fetch(:refunds, self.refunds)
  self.name = data.fetch(:name, self.name)
  self.amount = data.fetch(:amount, self.amount)
  self.amount_local = data.fetch(:amount_local, self.amount_local)
  self.authorized_amount = data.fetch(:authorized_amount, self.authorized_amount)
  self.authorized_amount_local = data.fetch(:authorized_amount_local, self.authorized_amount_local)
  self.captured_amount = data.fetch(:captured_amount, self.captured_amount)
  self.captured_amount_local = data.fetch(:captured_amount_local, self.captured_amount_local)
  self.refunded_amount = data.fetch(:refunded_amount, self.refunded_amount)
  self.refunded_amount_local = data.fetch(:refunded_amount_local, self.refunded_amount_local)
  self.available_amount = data.fetch(:available_amount, self.available_amount)
  self.available_amount_local = data.fetch(:available_amount_local, self.available_amount_local)
  self.voided_amount = data.fetch(:voided_amount, self.voided_amount)
  self.voided_amount_local = data.fetch(:voided_amount_local, self.voided_amount_local)
  self.currency = data.fetch(:currency, self.currency)
  self.error_code = data.fetch(:error_code, self.error_code)
  self.error_message = data.fetch(:error_message, self.error_message)
  self.acquirer_name = data.fetch(:acquirer_name, self.acquirer_name)
  self.gateway_name = data.fetch(:gateway_name, self.gateway_name)
  self.three_d_s_status = data.fetch(:three_d_s_status, self.three_d_s_status)
  self.status = data.fetch(:status, self.status)
  self.authorized = data.fetch(:authorized, self.authorized)
  self.captured = data.fetch(:captured, self.captured)
  self.voided = data.fetch(:voided, self.voided)
  self.refunded = data.fetch(:refunded, self.refunded)
  self.chargedback = data.fetch(:chargedback, self.chargedback)
  self.received_fraud_notification = data.fetch(:received_fraud_notification, self.received_fraud_notification)
  self.received_retrieval_request = data.fetch(:received_retrieval_request, self.received_retrieval_request)
  self.processout_fee = data.fetch(:processout_fee, self.processout_fee)
  self.estimated_fee = data.fetch(:estimated_fee, self.estimated_fee)
  self.gateway_fee = data.fetch(:gateway_fee, self.gateway_fee)
  self.gateway_fee_local = data.fetch(:gateway_fee_local, self.gateway_fee_local)
  self.currency_fee = data.fetch(:currency_fee, self.currency_fee)
  self. = data.fetch(:metadata, self.)
  self.sandbox = data.fetch(:sandbox, self.sandbox)
  self.created_at = data.fetch(:created_at, self.created_at)
  self.chargedback_at = data.fetch(:chargedback_at, self.chargedback_at)
  self.refunded_at = data.fetch(:refunded_at, self.refunded_at)
  self.authorized_at = data.fetch(:authorized_at, self.authorized_at)
  self.captured_at = data.fetch(:captured_at, self.captured_at)
  self.voided_at = data.fetch(:voided_at, self.voided_at)
  self.three_d_s = data.fetch(:three_d_s, self.three_d_s)
  self.cvc_check = data.fetch(:cvc_check, self.cvc_check)
  self.avs_check = data.fetch(:avs_check, self.avs_check)
  self.initial_scheme_transaction_id = data.fetch(:initial_scheme_transaction_id, self.initial_scheme_transaction_id)
  self.scheme_id = data.fetch(:scheme_id, self.scheme_id)
  self.payment_type = data.fetch(:payment_type, self.payment_type)
  self.eci = data.fetch(:eci, self.eci)
  self.native_apm = data.fetch(:native_apm, self.native_apm)
  self.external_details = data.fetch(:external_details, self.external_details)
  
  self
end

#to_json(options) ⇒ Object

Overrides the JSON marshaller to only send the fields we want



585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
# File 'lib/processout/transaction.rb', line 585

def to_json(options)
  {
      "id": self.id,
      "project": self.project,
      "project_id": self.project_id,
      "invoice": self.invoice,
      "invoice_id": self.invoice_id,
      "customer": self.customer,
      "customer_id": self.customer_id,
      "subscription": self.subscription,
      "subscription_id": self.subscription_id,
      "token": self.token,
      "token_id": self.token_id,
      "card": self.card,
      "card_id": self.card_id,
      "gateway_configuration": self.gateway_configuration,
      "external_three_d_s_gateway_configuration": self.external_three_d_s_gateway_configuration,
      "gateway_configuration_id": self.gateway_configuration_id,
      "operations": self.operations,
      "refunds": self.refunds,
      "name": self.name,
      "amount": self.amount,
      "amount_local": self.amount_local,
      "authorized_amount": self.authorized_amount,
      "authorized_amount_local": self.authorized_amount_local,
      "captured_amount": self.captured_amount,
      "captured_amount_local": self.captured_amount_local,
      "refunded_amount": self.refunded_amount,
      "refunded_amount_local": self.refunded_amount_local,
      "available_amount": self.available_amount,
      "available_amount_local": self.available_amount_local,
      "voided_amount": self.voided_amount,
      "voided_amount_local": self.voided_amount_local,
      "currency": self.currency,
      "error_code": self.error_code,
      "error_message": self.error_message,
      "acquirer_name": self.acquirer_name,
      "gateway_name": self.gateway_name,
      "three_d_s_status": self.three_d_s_status,
      "status": self.status,
      "authorized": self.authorized,
      "captured": self.captured,
      "voided": self.voided,
      "refunded": self.refunded,
      "chargedback": self.chargedback,
      "received_fraud_notification": self.received_fraud_notification,
      "received_retrieval_request": self.received_retrieval_request,
      "processout_fee": self.processout_fee,
      "estimated_fee": self.estimated_fee,
      "gateway_fee": self.gateway_fee,
      "gateway_fee_local": self.gateway_fee_local,
      "currency_fee": self.currency_fee,
      "metadata": self.,
      "sandbox": self.sandbox,
      "created_at": self.created_at,
      "chargedback_at": self.chargedback_at,
      "refunded_at": self.refunded_at,
      "authorized_at": self.authorized_at,
      "captured_at": self.captured_at,
      "voided_at": self.voided_at,
      "three_d_s": self.three_d_s,
      "cvc_check": self.cvc_check,
      "avs_check": self.avs_check,
      "initial_scheme_transaction_id": self.initial_scheme_transaction_id,
      "scheme_id": self.scheme_id,
      "payment_type": self.payment_type,
      "eci": self.eci,
      "native_apm": self.native_apm,
      "external_details": self.external_details,
  }.to_json
end