class OpenapiClient::ProcessorData

Model for processor data.

Attributes

association_response_code[RW]

Raw response code from issuer.

authorization_code[RW]

Code returned to confirm transaction.

avs_response[RW]
cardholder_info_response[RW]
debit_receipt_number[RW]

Receipt number from debit network provider.

merchant_advice_code_indicator[RW]

Code to map merchant advice code to ISO specification.

network[RW]

Network used for transaction.

reference_number[RW]

Reference transaction ID.

response_code[RW]

Response code from endpoints.

response_indicator[RW]

Indicates whether the transaction was routed through the payment card's own network or through a different network.

response_message[RW]

Message returned from endpoints.

security_code_response[RW]

Code returned for CVV.

transaction_integrity_class[RW]

MasterCard provided Transaction Integrity Class for Point of Sale (POS) Purchase and Purchase with Cash Back transactions initiated on the Authorization Platform.

Public Class Methods

attribute_map() click to toggle source

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

# File lib/openapi_client/models/processor_data.rb, line 78
def self.attribute_map
  {
    :'reference_number' => :'referenceNumber',
    :'authorization_code' => :'authorizationCode',
    :'response_code' => :'responseCode',
    :'network' => :'network',
    :'association_response_code' => :'associationResponseCode',
    :'response_message' => :'responseMessage',
    :'avs_response' => :'avsResponse',
    :'cardholder_info_response' => :'cardholderInfoResponse',
    :'security_code_response' => :'securityCodeResponse',
    :'merchant_advice_code_indicator' => :'merchantAdviceCodeIndicator',
    :'response_indicator' => :'responseIndicator',
    :'debit_receipt_number' => :'debitReceiptNumber',
    :'transaction_integrity_class' => :'transactionIntegrityClass'
  }
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/openapi_client/models/processor_data.rb, line 260
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/openapi_client/models/processor_data.rb, line 117
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::ProcessorData` 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 `OpenapiClient::ProcessorData`. 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?(:'reference_number')
    self.reference_number = attributes[:'reference_number']
  end

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

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

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

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

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

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

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

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

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

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

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

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

Attribute type mapping.

# File lib/openapi_client/models/processor_data.rb, line 97
def self.openapi_types
  {
    :'reference_number' => :'String',
    :'authorization_code' => :'String',
    :'response_code' => :'String',
    :'network' => :'String',
    :'association_response_code' => :'String',
    :'response_message' => :'String',
    :'avs_response' => :'AVSResponse',
    :'cardholder_info_response' => :'CardholderInfoResponse',
    :'security_code_response' => :'String',
    :'merchant_advice_code_indicator' => :'String',
    :'response_indicator' => :'String',
    :'debit_receipt_number' => :'String',
    :'transaction_integrity_class' => :'String'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/openapi_client/models/processor_data.rb, line 227
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      reference_number == o.reference_number &&
      authorization_code == o.authorization_code &&
      response_code == o.response_code &&
      network == o.network &&
      association_response_code == o.association_response_code &&
      response_message == o.response_message &&
      avs_response == o.avs_response &&
      cardholder_info_response == o.cardholder_info_response &&
      security_code_response == o.security_code_response &&
      merchant_advice_code_indicator == o.merchant_advice_code_indicator &&
      response_indicator == o.response_indicator &&
      debit_receipt_number == o.debit_receipt_number &&
      transaction_integrity_class == o.transaction_integrity_class
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/openapi_client/models/processor_data.rb, line 288
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
    klass = OpenapiClient.const_get(type)
    if klass.respond_to?(:openapi_discriminator_name)
      klass = OpenapiClient.const_get(value[klass.attribute_map[klass.openapi_discriminator_name]])
    end
 
    klass.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/openapi_client/models/processor_data.rb, line 362
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
build_from_hash(attributes, attribute_map = self.class.attribute_map, openapi_types = self.class.openapi_types) 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/openapi_client/models/processor_data.rb, line 267
def build_from_hash(attributes, attribute_map = self.class.attribute_map, openapi_types = self.class.openapi_types)
  return nil unless attributes.is_a?(Hash)
  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[attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
eql?(o) click to toggle source

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

# File lib/openapi_client/models/processor_data.rb, line 247
def eql?(o)
  self == o
end
hash() click to toggle source

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

# File lib/openapi_client/models/processor_data.rb, line 253
def hash
  [reference_number, authorization_code, response_code, network, association_response_code, response_message, avs_response, cardholder_info_response, security_code_response, merchant_advice_code_indicator, response_indicator, debit_receipt_number, transaction_integrity_class].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/openapi_client/models/processor_data.rb, line 185
def list_invalid_properties
  invalid_properties = Array.new
  pattern = Regexp.new(/[0-9]{2}/)
  if !@merchant_advice_code_indicator.nil? && @merchant_advice_code_indicator !~ pattern
    invalid_properties.push("invalid value for \"merchant_advice_code_indicator\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end
merchant_advice_code_indicator=(merchant_advice_code_indicator) click to toggle source

Custom attribute writer method with validation @param [Object] merchant_advice_code_indicator Value to be assigned

# File lib/openapi_client/models/processor_data.rb, line 216
def merchant_advice_code_indicator=(merchant_advice_code_indicator)
  pattern = Regexp.new(/[0-9]{2}/)
  if !merchant_advice_code_indicator.nil? && merchant_advice_code_indicator !~ pattern
    fail ArgumentError, "invalid value for \"merchant_advice_code_indicator\", must conform to the pattern #{pattern}."
  end

  @merchant_advice_code_indicator = merchant_advice_code_indicator
end
security_code_response=(security_code_response) click to toggle source

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

# File lib/openapi_client/models/processor_data.rb, line 206
def security_code_response=(security_code_response)
  validator = EnumAttributeValidator.new('String', ["MATCHED", "NOT_MATCHED", "NOT_PROCESSED", "NOT_PRESENT", "NOT_CERTIFIED", "NOT_CHECKED"])
  unless validator.valid?(security_code_response)
    fail ArgumentError, "invalid value for \"security_code_response\", must be one of #{validator.allowable_values}."
  end
  @security_code_response = security_code_response
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/openapi_client/models/processor_data.rb, line 338
def to_body
  to_hash
end
to_hash(attribute_map = self.class.attribute_map, openapi_nullable = Set.new([])) click to toggle source

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

# File lib/openapi_client/models/processor_data.rb, line 344
def to_hash(attribute_map = self.class.attribute_map, openapi_nullable = Set.new([]))
  hash = {}
  attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end
    
    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/openapi_client/models/processor_data.rb, line 332
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/openapi_client/models/processor_data.rb, line 197
def valid?
  security_code_response_validator = EnumAttributeValidator.new('String', ["MATCHED", "NOT_MATCHED", "NOT_PROCESSED", "NOT_PRESENT", "NOT_CERTIFIED", "NOT_CHECKED"])
  return false unless security_code_response_validator.valid?(@security_code_response)
  return false if !@merchant_advice_code_indicator.nil? && @merchant_advice_code_indicator !~ Regexp.new(/[0-9]{2}/)
  true
end