Class: Braintree::Dispute

Inherits:
Object
  • Object
show all
Includes:
BaseModule, Util::IdEquality
Defined in:
lib/braintree/dispute.rb,
lib/braintree/dispute/evidence.rb,
lib/braintree/dispute/transaction.rb,
lib/braintree/dispute/paypal_message.rb,
lib/braintree/dispute/status_history.rb,
lib/braintree/dispute/transaction_details.rb

Defined Under Namespace

Modules: ChargebackProtectionLevel, Kind, PreDisputeProgram, ProtectionLevel, Reason, Status Classes: Evidence, PayPalMessage, StatusHistory, Transaction, TransactionDetails

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util::IdEquality

#==

Methods included from BaseModule

included

Methods included from BaseModule::Methods

#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class

Constructor Details

#initialize(attributes) ⇒ Dispute

Returns a new instance of Dispute.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/braintree/dispute.rb', line 135

def initialize(attributes)
  set_instance_variables_from_hash(attributes)
  @date_opened = Date.parse(date_opened) unless date_opened.nil?
  @date_won = Date.parse(date_won) unless date_won.nil?
  @received_date = Date.parse(received_date)
  @reply_by_date = Date.parse(reply_by_date) unless reply_by_date.nil?
  @amount = Util.to_big_decimal(amount)
  @amount_disputed = Util.to_big_decimal(amount_disputed)
  @amount_won = Util.to_big_decimal(amount_won)
  if (ChargebackProtectionLevel::All - [ChargebackProtectionLevel::NotProtected]).include?(chargeback_protection_level)
    @protection_level = Dispute.const_get("ProtectionLevel::#{chargeback_protection_level.capitalize}CBP")
  else
    @protection_level = ProtectionLevel::NoProtection
  end

  @evidence = evidence.map do |record|
    Braintree::Dispute::Evidence.new(record)
  end unless evidence.nil?

  @paypal_messages = paypal_messages.map do |record|
    Braintree::Dispute::PayPalMessage.new(record)
  end unless paypal_messages.nil?

  @transaction_details = TransactionDetails.new(transaction)
  @transaction = Transaction.new(transaction)

  @status_history = status_history.map do |event|
    Braintree::Dispute::StatusHistory.new(event)
  end unless status_history.nil?
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



6
7
8
# File 'lib/braintree/dispute.rb', line 6

def amount
  @amount
end

#amount_disputedObject (readonly)

Returns the value of attribute amount_disputed.



7
8
9
# File 'lib/braintree/dispute.rb', line 7

def amount_disputed
  @amount_disputed
end

#amount_wonObject (readonly)

Returns the value of attribute amount_won.



8
9
10
# File 'lib/braintree/dispute.rb', line 8

def amount_won
  @amount_won
end

#case_numberObject (readonly)

Returns the value of attribute case_number.



9
10
11
# File 'lib/braintree/dispute.rb', line 9

def case_number
  @case_number
end

#chargeback_protection_levelObject (readonly)

NEXT_MAJOR_VERSION Remove this attribute DEPRECATED The chargeback_protection_level attribute is deprecated in favor of protection_level



12
13
14
# File 'lib/braintree/dispute.rb', line 12

def chargeback_protection_level
  @chargeback_protection_level
end

#created_atObject (readonly)

Returns the value of attribute created_at.



13
14
15
# File 'lib/braintree/dispute.rb', line 13

def created_at
  @created_at
end

#currency_iso_codeObject (readonly)

Returns the value of attribute currency_iso_code.



14
15
16
# File 'lib/braintree/dispute.rb', line 14

def currency_iso_code
  @currency_iso_code
end

#date_openedObject (readonly)

Returns the value of attribute date_opened.



15
16
17
# File 'lib/braintree/dispute.rb', line 15

def date_opened
  @date_opened
end

#date_wonObject (readonly)

Returns the value of attribute date_won.



16
17
18
# File 'lib/braintree/dispute.rb', line 16

def date_won
  @date_won
end

#evidenceObject (readonly)

Returns the value of attribute evidence.



17
18
19
# File 'lib/braintree/dispute.rb', line 17

def evidence
  @evidence
end

#graphql_idObject (readonly)

Returns the value of attribute graphql_id.



18
19
20
# File 'lib/braintree/dispute.rb', line 18

def graphql_id
  @graphql_id
end

#idObject (readonly)

Returns the value of attribute id.



19
20
21
# File 'lib/braintree/dispute.rb', line 19

def id
  @id
end

#kindObject (readonly)

Returns the value of attribute kind.



20
21
22
# File 'lib/braintree/dispute.rb', line 20

def kind
  @kind
end

#merchant_account_idObject (readonly)

Returns the value of attribute merchant_account_id.



21
22
23
# File 'lib/braintree/dispute.rb', line 21

def 
  
end

#original_dispute_idObject (readonly)

Returns the value of attribute original_dispute_id.



22
23
24
# File 'lib/braintree/dispute.rb', line 22

def original_dispute_id
  @original_dispute_id
end

#paypal_messagesObject (readonly)

Returns the value of attribute paypal_messages.



23
24
25
# File 'lib/braintree/dispute.rb', line 23

def paypal_messages
  @paypal_messages
end

#pre_dispute_programObject (readonly)

Returns the value of attribute pre_dispute_program.



24
25
26
# File 'lib/braintree/dispute.rb', line 24

def pre_dispute_program
  @pre_dispute_program
end

#processor_commentsObject (readonly)

Returns the value of attribute processor_comments.



25
26
27
# File 'lib/braintree/dispute.rb', line 25

def processor_comments
  @processor_comments
end

#protection_levelObject (readonly)

Returns the value of attribute protection_level.



26
27
28
# File 'lib/braintree/dispute.rb', line 26

def protection_level
  @protection_level
end

#reasonObject (readonly)

Returns the value of attribute reason.



27
28
29
# File 'lib/braintree/dispute.rb', line 27

def reason
  @reason
end

#reason_codeObject (readonly)

Returns the value of attribute reason_code.



28
29
30
# File 'lib/braintree/dispute.rb', line 28

def reason_code
  @reason_code
end

#reason_descriptionObject (readonly)

Returns the value of attribute reason_description.



29
30
31
# File 'lib/braintree/dispute.rb', line 29

def reason_description
  @reason_description
end

#received_dateObject (readonly)

Returns the value of attribute received_date.



30
31
32
# File 'lib/braintree/dispute.rb', line 30

def received_date
  @received_date
end

#reference_numberObject (readonly)

Returns the value of attribute reference_number.



31
32
33
# File 'lib/braintree/dispute.rb', line 31

def reference_number
  @reference_number
end

#remaining_file_evidence_storageObject (readonly)

Returns the value of attribute remaining_file_evidence_storage.



35
36
37
# File 'lib/braintree/dispute.rb', line 35

def remaining_file_evidence_storage
  @remaining_file_evidence_storage
end

#reply_by_dateObject (readonly)

Returns the value of attribute reply_by_date.



32
33
34
# File 'lib/braintree/dispute.rb', line 32

def reply_by_date
  @reply_by_date
end

#statusObject (readonly)

Returns the value of attribute status.



33
34
35
# File 'lib/braintree/dispute.rb', line 33

def status
  @status
end

#status_historyObject (readonly)

Returns the value of attribute status_history.



34
35
36
# File 'lib/braintree/dispute.rb', line 34

def status_history
  @status_history
end

#transactionObject (readonly)

Returns the value of attribute transaction.



36
37
38
# File 'lib/braintree/dispute.rb', line 36

def transaction
  @transaction
end

#transaction_detailsObject (readonly)

Returns the value of attribute transaction_details.



37
38
39
# File 'lib/braintree/dispute.rb', line 37

def transaction_details
  @transaction_details
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



38
39
40
# File 'lib/braintree/dispute.rb', line 38

def updated_at
  @updated_at
end

Class Method Details

._new(*args) ⇒ Object



102
103
104
# File 'lib/braintree/dispute.rb', line 102

def _new(*args)
  self.new(*args)
end

.accept(*args) ⇒ Object



107
108
109
# File 'lib/braintree/dispute.rb', line 107

def self.accept(*args)
  Configuration.gateway.dispute.accept(*args)
end

.add_file_evidence(*args) ⇒ Object



111
112
113
# File 'lib/braintree/dispute.rb', line 111

def self.add_file_evidence(*args)
  Configuration.gateway.dispute.add_file_evidence(*args)
end

.add_text_evidence(*args) ⇒ Object



115
116
117
# File 'lib/braintree/dispute.rb', line 115

def self.add_text_evidence(*args)
  Configuration.gateway.dispute.add_text_evidence(*args)
end

.finalize(*args) ⇒ Object



119
120
121
# File 'lib/braintree/dispute.rb', line 119

def self.finalize(*args)
  Configuration.gateway.dispute.finalize(*args)
end

.find(*args) ⇒ Object



123
124
125
# File 'lib/braintree/dispute.rb', line 123

def self.find(*args)
  Configuration.gateway.dispute.find(*args)
end

.remove_evidence(*args) ⇒ Object



127
128
129
# File 'lib/braintree/dispute.rb', line 127

def self.remove_evidence(*args)
  Configuration.gateway.dispute.remove_evidence(*args)
end

.search(&block) ⇒ Object



131
132
133
# File 'lib/braintree/dispute.rb', line 131

def self.search(&block)
  Configuration.gateway.dispute.search(&block)
end