class CityPayApiClient::AuthRequest

Attributes

airline_data[RW]
amount[RW]

The amount to authorise in the lowest unit of currency with a variable length to a maximum of 12 digits. No decimal points are to be included and no divisional characters such as 1,024. The amount should be the total amount required for the transaction. For example with GBP £1,021.95 the amount value is 102195.

avs_postcode_policy[RW]

A policy value which determines whether an AVS postcode policy is enforced or bypassed. Values are `0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be rejected if the AVS postcode numeric value does not match. `2` to bypass. Transactions that are bypassed will be allowed through even if the postcode did not match. `3` to ignore. Transactions that are ignored will bypass the result and not send postcode details for authorisation.

bill_to[RW]
card_holder_name[RW]

The card holder name as appears on the card such as MR N E BODY. Required for some acquirers.

cardnumber[RW]

The card number (PAN) with a variable length to a maximum of 21 digits in numerical form. Any non numeric characters will be stripped out of the card number, this includes whitespace or separators internal of the provided value. The card number must be treated as sensitive data. We only provide an obfuscated value in logging and reporting. The plaintext value is encrypted in our database using AES 256 GMC bit encryption for settlement or refund purposes. When providing the card number to our gateway through the authorisation API you will be handling the card data on your application. This will require further PCI controls to be in place and this value must never be stored.

csc[RW]

The Card Security Code (CSC) (also known as CV2/CVV2) is normally found on the back of the card (American Express has it on the front). The value helps to identify posession of the card as it is not available within the chip or magnetic swipe. When forwarding the CSC, please ensure the value is a string as some values start with 0 and this will be stripped out by any integer parsing. The CSC number aids fraud prevention in Mail Order and Internet payments. Business rules are available on your account to identify whether to accept or decline transactions based on mismatched results of the CSC. The Payment Card Industry (PCI) requires that at no stage of a transaction should the CSC be stored. This applies to all entities handling card data. It should also not be used in any hashing process. CityPay do not store the value and have no method of retrieving the value once the transaction has been processed. For this reason, duplicate checking is unable to determine the CSC in its duplication check algorithm.

csc_policy[RW]

A policy value which determines whether a CSC policy is enforced or bypassed. Values are `0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be rejected if the CSC value does not match. `2` to bypass. Transactions that are bypassed will be allowed through even if the CSC did not match. `3` to ignore. Transactions that are ignored will bypass the result and not send the CSC details for authorisation.

currency[RW]

The processing currency for the transaction. Will default to the merchant account currency.

duplicate_policy[RW]

A policy value which determines whether a duplication policy is enforced or bypassed. A duplication check has a window of time set against your account within which it can action. If a previous transaction with matching values occurred within the window, any subsequent transaction will result in a T001 result. Values are `0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be checked for duplication within the duplication window. `2` to bypass. Transactions that are bypassed will not be checked for duplication within the duplication window. `3` to ignore. Transactions that are ignored will have the same affect as bypass.

expmonth[RW]

The month of expiry of the card. The month value should be a numerical value between 1 and 12.

expyear[RW]

The year of expiry of the card.

external_mpi[RW]
identifier[RW]

The identifier of the transaction to process. The value should be a valid reference and may be used to perform post processing actions and to aid in reconciliation of transactions. The value should be a valid printable string with ASCII character ranges from 32 to 127. The identifier is recommended to be distinct for each transaction such as a [random unique identifier](en.wikipedia.org/wiki/Universally_unique_identifier) this will aid in ensuring each transaction is identifiable. When transactions are processed they are also checked for duplicate requests. Changing the identifier on a subsequent request will ensure that a transaction is considered as different.

match_avsa[RW]

A policy value which determines whether an AVS address policy is enforced, bypassed or ignored. Values are `0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be rejected if the AVS address numeric value does not match. `2` to bypass. Transactions that are bypassed will be allowed through even if the address did not match. `3` to ignore. Transactions that are ignored will bypass the result and not send address numeric details for authorisation.

mcc6012[RW]
merchantid[RW]

Identifies the merchant account to perform processing for.

sdk[RW]

An optional reference value for the calling client such as a version number i.e.

ship_to[RW]
threedsecure[RW]
trans_info[RW]

Further information that can be added to the transaction will display in reporting. Can be used for flexible values such as operator id.

trans_type[RW]

The type of transaction being submitted. Normally this value is not required and your account manager may request that you set this field.

Public Class Methods

attribute_map() click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 77
def self.attribute_map
  {
    :'airline_data' => :'airline_data',
    :'amount' => :'amount',
    :'avs_postcode_policy' => :'avs_postcode_policy',
    :'bill_to' => :'bill_to',
    :'card_holder_name' => :'card_holder_name',
    :'cardnumber' => :'cardnumber',
    :'csc' => :'csc',
    :'csc_policy' => :'csc_policy',
    :'currency' => :'currency',
    :'duplicate_policy' => :'duplicate_policy',
    :'expmonth' => :'expmonth',
    :'expyear' => :'expyear',
    :'external_mpi' => :'external_mpi',
    :'identifier' => :'identifier',
    :'match_avsa' => :'match_avsa',
    :'mcc6012' => :'mcc6012',
    :'merchantid' => :'merchantid',
    :'sdk' => :'sdk',
    :'ship_to' => :'ship_to',
    :'threedsecure' => :'threedsecure',
    :'trans_info' => :'trans_info',
    :'trans_type' => :'trans_type'
  }
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/citypay_api_client/models/auth_request.rb, line 521
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/citypay_api_client/models/auth_request.rb, line 140
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::AuthRequest` 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 `CityPayApiClient::AuthRequest`. 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?(:'airline_data')
    self.airline_data = attributes[:'airline_data']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'sdk')
    self.sdk = attributes[:'sdk']
  else
    self.sdk = CityPayApiClient::FULL_VERSION
  end

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

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

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

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

List of attributes with nullable: true

# File lib/citypay_api_client/models/auth_request.rb, line 133
def self.openapi_nullable
  Set.new([
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/citypay_api_client/models/auth_request.rb, line 105
def self.openapi_types
  {
    :'airline_data' => :'AirlineAdvice',
    :'amount' => :'Integer',
    :'avs_postcode_policy' => :'String',
    :'bill_to' => :'ContactDetails',
    :'card_holder_name' => :'String',
    :'cardnumber' => :'String',
    :'csc' => :'String',
    :'csc_policy' => :'String',
    :'currency' => :'String',
    :'duplicate_policy' => :'String',
    :'expmonth' => :'Integer',
    :'expyear' => :'Integer',
    :'external_mpi' => :'ExternalMPI',
    :'identifier' => :'String',
    :'match_avsa' => :'String',
    :'mcc6012' => :'MCC6012',
    :'merchantid' => :'Integer',
    :'sdk' => :'String',
    :'ship_to' => :'ContactDetails',
    :'threedsecure' => :'ThreeDSecure',
    :'trans_info' => :'String',
    :'trans_type' => :'String'
  }
end

Public Instance Methods

==(o) click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 479
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      airline_data == o.airline_data &&
      amount == o.amount &&
      avs_postcode_policy == o.avs_postcode_policy &&
      bill_to == o.bill_to &&
      card_holder_name == o.card_holder_name &&
      cardnumber == o.cardnumber &&
      csc == o.csc &&
      csc_policy == o.csc_policy &&
      currency == o.currency &&
      duplicate_policy == o.duplicate_policy &&
      expmonth == o.expmonth &&
      expyear == o.expyear &&
      external_mpi == o.external_mpi &&
      identifier == o.identifier &&
      match_avsa == o.match_avsa &&
      mcc6012 == o.mcc6012 &&
      merchantid == o.merchantid &&
      sdk == o.sdk &&
      ship_to == o.ship_to &&
      threedsecure == o.threedsecure &&
      trans_info == o.trans_info &&
      trans_type == o.trans_type
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/citypay_api_client/models/auth_request.rb, line 549
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
    CityPayApiClient.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/citypay_api_client/models/auth_request.rb, line 618
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) 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/citypay_api_client/models/auth_request.rb, line 528
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
cardnumber=(cardnumber) click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 359
def cardnumber=(cardnumber)
  if cardnumber.nil?
    fail ArgumentError, 'cardnumber cannot be nil'
  end

  if cardnumber.to_s.length > 22
    fail ArgumentError, 'invalid value for "cardnumber", the character length must be smaller than or equal to 22.'
  end

  if cardnumber.to_s.length < 12
    fail ArgumentError, 'invalid value for "cardnumber", the character length must be great than or equal to 12.'
  end

  @cardnumber = cardnumber
end
csc=(csc) click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 377
def csc=(csc)
  if !csc.nil? && csc.to_s.length > 4
    fail ArgumentError, 'invalid value for "csc", the character length must be smaller than or equal to 4.'
  end

  if !csc.nil? && csc.to_s.length < 3
    fail ArgumentError, 'invalid value for "csc", the character length must be great than or equal to 3.'
  end

  @csc = csc
end
currency=(currency) click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 391
def currency=(currency)
  if !currency.nil? && currency.to_s.length > 3
    fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.'
  end

  if !currency.nil? && currency.to_s.length < 3
    fail ArgumentError, 'invalid value for "currency", the character length must be great than or equal to 3.'
  end

  @currency = currency
end
eql?(o) click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 508
def eql?(o)
  self == o
end
expmonth=(expmonth) click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 405
def expmonth=(expmonth)
  if expmonth.nil?
    fail ArgumentError, 'expmonth cannot be nil'
  end

  if expmonth > 12
    fail ArgumentError, 'invalid value for "expmonth", must be smaller than or equal to 12.'
  end

  if expmonth < 1
    fail ArgumentError, 'invalid value for "expmonth", must be greater than or equal to 1.'
  end

  @expmonth = expmonth
end
expyear=(expyear) click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 423
def expyear=(expyear)
  if expyear.nil?
    fail ArgumentError, 'expyear cannot be nil'
  end

  if expyear > 2100
    fail ArgumentError, 'invalid value for "expyear", must be smaller than or equal to 2100.'
  end

  if expyear < 2000
    fail ArgumentError, 'invalid value for "expyear", must be greater than or equal to 2000.'
  end

  @expyear = expyear
end
hash() click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 514
def hash
  [airline_data, amount, avs_postcode_policy, bill_to, card_holder_name, cardnumber, csc, csc_policy, currency, duplicate_policy, expmonth, expyear, external_mpi, identifier, match_avsa, mcc6012, merchantid, sdk, ship_to, threedsecure, trans_info, trans_type].hash
end
identifier=(identifier) click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 441
def identifier=(identifier)
  if identifier.nil?
    fail ArgumentError, 'identifier cannot be nil'
  end

  if identifier.to_s.length > 50
    fail ArgumentError, 'invalid value for "identifier", the character length must be smaller than or equal to 50.'
  end

  if identifier.to_s.length < 4
    fail ArgumentError, 'invalid value for "identifier", the character length must be great than or equal to 4.'
  end

  @identifier = identifier
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/citypay_api_client/models/auth_request.rb, line 246
def list_invalid_properties
  invalid_properties = Array.new
  if @amount.nil?
    invalid_properties.push('invalid value for "amount", amount cannot be nil.')
  end

  if @cardnumber.nil?
    invalid_properties.push('invalid value for "cardnumber", cardnumber cannot be nil.')
  end

  if @cardnumber.to_s.length > 22
    invalid_properties.push('invalid value for "cardnumber", the character length must be smaller than or equal to 22.')
  end

  if @cardnumber.to_s.length < 12
    invalid_properties.push('invalid value for "cardnumber", the character length must be great than or equal to 12.')
  end

  if !@csc.nil? && @csc.to_s.length > 4
    invalid_properties.push('invalid value for "csc", the character length must be smaller than or equal to 4.')
  end

  if !@csc.nil? && @csc.to_s.length < 3
    invalid_properties.push('invalid value for "csc", the character length must be great than or equal to 3.')
  end

  if !@currency.nil? && @currency.to_s.length > 3
    invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.')
  end

  if !@currency.nil? && @currency.to_s.length < 3
    invalid_properties.push('invalid value for "currency", the character length must be great than or equal to 3.')
  end

  if @expmonth.nil?
    invalid_properties.push('invalid value for "expmonth", expmonth cannot be nil.')
  end

  if @expmonth > 12
    invalid_properties.push('invalid value for "expmonth", must be smaller than or equal to 12.')
  end

  if @expmonth < 1
    invalid_properties.push('invalid value for "expmonth", must be greater than or equal to 1.')
  end

  if @expyear.nil?
    invalid_properties.push('invalid value for "expyear", expyear cannot be nil.')
  end

  if @expyear > 2100
    invalid_properties.push('invalid value for "expyear", must be smaller than or equal to 2100.')
  end

  if @expyear < 2000
    invalid_properties.push('invalid value for "expyear", must be greater than or equal to 2000.')
  end

  if @identifier.nil?
    invalid_properties.push('invalid value for "identifier", identifier cannot be nil.')
  end

  if @identifier.to_s.length > 50
    invalid_properties.push('invalid value for "identifier", the character length must be smaller than or equal to 50.')
  end

  if @identifier.to_s.length < 4
    invalid_properties.push('invalid value for "identifier", the character length must be great than or equal to 4.')
  end

  if @merchantid.nil?
    invalid_properties.push('invalid value for "merchantid", merchantid cannot be nil.')
  end

  if !@trans_info.nil? && @trans_info.to_s.length > 50
    invalid_properties.push('invalid value for "trans_info", the character length must be smaller than or equal to 50.')
  end

  if !@trans_type.nil? && @trans_type.to_s.length > 1
    invalid_properties.push('invalid value for "trans_type", the character length must be smaller than or equal to 1.')
  end

  invalid_properties
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/citypay_api_client/models/auth_request.rb, line 594
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/citypay_api_client/models/auth_request.rb, line 600
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.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/citypay_api_client/models/auth_request.rb, line 588
def to_s
  to_hash.to_s
end
trans_info=(trans_info) click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 459
def trans_info=(trans_info)
  if !trans_info.nil? && trans_info.to_s.length > 50
    fail ArgumentError, 'invalid value for "trans_info", the character length must be smaller than or equal to 50.'
  end

  @trans_info = trans_info
end
trans_type=(trans_type) click to toggle source

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

# File lib/citypay_api_client/models/auth_request.rb, line 469
def trans_type=(trans_type)
  if !trans_type.nil? && trans_type.to_s.length > 1
    fail ArgumentError, 'invalid value for "trans_type", the character length must be smaller than or equal to 1.'
  end

  @trans_type = trans_type
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/citypay_api_client/models/auth_request.rb, line 333
def valid?
  return false if @amount.nil?
  return false if @cardnumber.nil?
  return false if @cardnumber.to_s.length > 22
  return false if @cardnumber.to_s.length < 12
  return false if !@csc.nil? && @csc.to_s.length > 4
  return false if !@csc.nil? && @csc.to_s.length < 3
  return false if !@currency.nil? && @currency.to_s.length > 3
  return false if !@currency.nil? && @currency.to_s.length < 3
  return false if @expmonth.nil?
  return false if @expmonth > 12
  return false if @expmonth < 1
  return false if @expyear.nil?
  return false if @expyear > 2100
  return false if @expyear < 2000
  return false if @identifier.nil?
  return false if @identifier.to_s.length > 50
  return false if @identifier.to_s.length < 4
  return false if @merchantid.nil?
  return false if !@trans_info.nil? && @trans_info.to_s.length > 50
  return false if !@trans_type.nil? && @trans_type.to_s.length > 1
  true
end