class Yapstone::CompositeDispute

Represents singe dispute object

Attributes

action[RW]
arn[RW]

Acquirer reference number references the transaction in acquiring processor

case_numbers[RW]

Case numbers reported by the processor

created_on[RW]
disposition_reason[RW]

Final disposition reason

dispute_amount[RW]
dispute_workflow[RW]

Status of the dispute at the card scheme

evidence_id[RW]
final_disposition[RW]
id[RW]
original_transaction[RW]
processor_notes[RW]
reason[RW]
response_due_date[RW]
status[RW]
status_updated_on[RW]

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/yapstone-disputes/models/composite_dispute.rb, line 77
def self.attribute_map
  {
    :'id' => :'id',
    :'arn' => :'arn',
    :'case_numbers' => :'caseNumbers',
    :'evidence_id' => :'evidenceId',
    :'action' => :'action',
    :'status' => :'status',
    :'status_updated_on' => :'statusUpdatedOn',
    :'dispute_amount' => :'disputeAmount',
    :'dispute_workflow' => :'disputeWorkflow',
    :'final_disposition' => :'finalDisposition',
    :'disposition_reason' => :'dispositionReason',
    :'original_transaction' => :'originalTransaction',
    :'reason' => :'reason',
    :'response_due_date' => :'responseDueDate',
    :'processor_notes' => :'processorNotes',
    :'created_on' => :'createdOn'
  }
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/yapstone-disputes/models/composite_dispute.rb, line 308
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/yapstone-disputes/models/composite_dispute.rb, line 122
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Yapstone::CompositeDispute` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Yapstone::CompositeDispute`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'arn')
    self.arn = attributes[:'arn']
  end

  if attributes.key?(:'case_numbers')
    if (value = attributes[:'case_numbers']).is_a?(Array)
      self.case_numbers = value
    end
  end

  if attributes.key?(:'evidence_id')
    self.evidence_id = attributes[:'evidence_id']
  end

  if attributes.key?(:'action')
    self.action = attributes[:'action']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'status_updated_on')
    self.status_updated_on = attributes[:'status_updated_on']
  end

  if attributes.key?(:'dispute_amount')
    self.dispute_amount = attributes[:'dispute_amount']
  end

  if attributes.key?(:'dispute_workflow')
    self.dispute_workflow = attributes[:'dispute_workflow']
  end

  if attributes.key?(:'final_disposition')
    self.final_disposition = attributes[:'final_disposition']
  end

  if attributes.key?(:'disposition_reason')
    self.disposition_reason = attributes[:'disposition_reason']
  end

  if attributes.key?(:'original_transaction')
    self.original_transaction = attributes[:'original_transaction']
  end

  if attributes.key?(:'reason')
    self.reason = attributes[:'reason']
  end

  if attributes.key?(:'response_due_date')
    self.response_due_date = attributes[:'response_due_date']
  end

  if attributes.key?(:'processor_notes')
    if (value = attributes[:'processor_notes']).is_a?(Array)
      self.processor_notes = value
    end
  end

  if attributes.key?(:'created_on')
    self.created_on = attributes[:'created_on']
  end
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/yapstone-disputes/models/composite_dispute.rb, line 99
def self.openapi_types
  {
    :'id' => :'String',
    :'arn' => :'String',
    :'case_numbers' => :'Array<String>',
    :'evidence_id' => :'String',
    :'action' => :'String',
    :'status' => :'String',
    :'status_updated_on' => :'DateTime',
    :'dispute_amount' => :'Amount',
    :'dispute_workflow' => :'String',
    :'final_disposition' => :'String',
    :'disposition_reason' => :'String',
    :'original_transaction' => :'OriginalTransaction',
    :'reason' => :'CompositeReason',
    :'response_due_date' => :'DateTime',
    :'processor_notes' => :'Array<String>',
    :'created_on' => :'DateTime'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/yapstone-disputes/models/composite_dispute.rb, line 272
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      arn == o.arn &&
      case_numbers == o.case_numbers &&
      evidence_id == o.evidence_id &&
      action == o.action &&
      status == o.status &&
      status_updated_on == o.status_updated_on &&
      dispute_amount == o.dispute_amount &&
      dispute_workflow == o.dispute_workflow &&
      final_disposition == o.final_disposition &&
      disposition_reason == o.disposition_reason &&
      original_transaction == o.original_transaction &&
      reason == o.reason &&
      response_due_date == o.response_due_date &&
      processor_notes == o.processor_notes &&
      created_on == o.created_on
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/yapstone-disputes/models/composite_dispute.rb, line 336
def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    Yapstone.const_get(type).build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/yapstone-disputes/models/composite_dispute.rb, line 401
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
action=(action) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] action Object to be assigned

# File lib/yapstone-disputes/models/composite_dispute.rb, line 232
def action=(action)
  validator = EnumAttributeValidator.new('String', ["ACCEPT", "CONTEST"])
  unless validator.valid?(action)
    fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
  end
  @action = action
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/yapstone-disputes/models/composite_dispute.rb, line 315
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
dispute_workflow=(dispute_workflow) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] dispute_workflow Object to be assigned

# File lib/yapstone-disputes/models/composite_dispute.rb, line 252
def dispute_workflow=(dispute_workflow)
  validator = EnumAttributeValidator.new('String', ["ARBITRATION", "CHARGEBACK", "CHARGEBACK_CANCEL", "CHARGEBACK_CREDIT", "COMPLIANCE", "FIRST_CHARGEBACK", "INQUIRY", "PRE_ARBITRATION", "PRE_COMPLIANCE", "REPRESENTMENT", "REPRESENTMENT_REJECT", "RETRIEVAL_REQUEST", "SECOND_CHARGEBACK", "UNKNOWN"])
  unless validator.valid?(dispute_workflow)
    fail ArgumentError, "invalid value for \"dispute_workflow\", must be one of #{validator.allowable_values}."
  end
  @dispute_workflow = dispute_workflow
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/yapstone-disputes/models/composite_dispute.rb, line 295
def eql?(o)
  self == o
end
final_disposition=(final_disposition) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] final_disposition Object to be assigned

# File lib/yapstone-disputes/models/composite_dispute.rb, line 262
def final_disposition=(final_disposition)
  validator = EnumAttributeValidator.new('String', ["WON", "LOST"])
  unless validator.valid?(final_disposition)
    fail ArgumentError, "invalid value for \"final_disposition\", must be one of #{validator.allowable_values}."
  end
  @final_disposition = final_disposition
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# File lib/yapstone-disputes/models/composite_dispute.rb, line 301
def hash
  [id, arn, case_numbers, evidence_id, action, status, status_updated_on, dispute_amount, dispute_workflow, final_disposition, disposition_reason, original_transaction, reason, response_due_date, processor_notes, created_on].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/yapstone-disputes/models/composite_dispute.rb, line 206
def list_invalid_properties
  invalid_properties = Array.new
  if @dispute_workflow.nil?
    invalid_properties.push('invalid value for "dispute_workflow", dispute_workflow cannot be nil.')
  end

  invalid_properties
end
status=(status) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] status Object to be assigned

# File lib/yapstone-disputes/models/composite_dispute.rb, line 242
def status=(status)
  validator = EnumAttributeValidator.new('String', ["NEW", "EVIDENCE_REQUESTED", "EVIDENCE_RECEIVED", "DECISION_PENDING", "EXPIRED", "CLOSED"])
  unless validator.valid?(status)
    fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
  end
  @status = status
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/yapstone-disputes/models/composite_dispute.rb, line 381
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/yapstone-disputes/models/composite_dispute.rb, line 387
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/yapstone-disputes/models/composite_dispute.rb, line 375
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/yapstone-disputes/models/composite_dispute.rb, line 217
def valid?
  action_validator = EnumAttributeValidator.new('String', ["ACCEPT", "CONTEST"])
  return false unless action_validator.valid?(@action)
  status_validator = EnumAttributeValidator.new('String', ["NEW", "EVIDENCE_REQUESTED", "EVIDENCE_RECEIVED", "DECISION_PENDING", "EXPIRED", "CLOSED"])
  return false unless status_validator.valid?(@status)
  return false if @dispute_workflow.nil?
  dispute_workflow_validator = EnumAttributeValidator.new('String', ["ARBITRATION", "CHARGEBACK", "CHARGEBACK_CANCEL", "CHARGEBACK_CREDIT", "COMPLIANCE", "FIRST_CHARGEBACK", "INQUIRY", "PRE_ARBITRATION", "PRE_COMPLIANCE", "REPRESENTMENT", "REPRESENTMENT_REJECT", "RETRIEVAL_REQUEST", "SECOND_CHARGEBACK", "UNKNOWN"])
  return false unless dispute_workflow_validator.valid?(@dispute_workflow)
  final_disposition_validator = EnumAttributeValidator.new('String', ["WON", "LOST"])
  return false unless final_disposition_validator.valid?(@final_disposition)
  true
end