Class: OCI::OspGateway::Models::OtherPaymentDetail

Inherits:
PaymentDetail
  • Object
show all
Defined in:
lib/oci/osp_gateway/models/other_payment_detail.rb

Overview

Other Payment related details

Constant Summary collapse

CREDIT_CARD_TYPE_ENUM =
[
  CREDIT_CARD_TYPE_VISA = 'VISA'.freeze,
  CREDIT_CARD_TYPE_AMEX = 'AMEX'.freeze,
  CREDIT_CARD_TYPE_MASTERCARD = 'MASTERCARD'.freeze,
  CREDIT_CARD_TYPE_DISCOVER = 'DISCOVER'.freeze,
  CREDIT_CARD_TYPE_JCB = 'JCB'.freeze,
  CREDIT_CARD_TYPE_DINER = 'DINER'.freeze,
  CREDIT_CARD_TYPE_ELO = 'ELO'.freeze,
  CREDIT_CARD_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from PaymentDetail

PaymentDetail::PAYMENT_METHOD_ENUM

Instance Attribute Summary collapse

Attributes inherited from PaymentDetail

#amount_paid, #paid_by, #payment_method, #time_paid_on

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PaymentDetail

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ OtherPaymentDetail

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :time_paid_on (DateTime)

    The value to assign to the #time_paid_on proprety

  • :paid_by (String)

    The value to assign to the #paid_by proprety

  • :amount_paid (Float)

    The value to assign to the #amount_paid proprety

  • :echeck_routing (String)

    The value to assign to the #echeck_routing property

  • :name_on_card (String)

    The value to assign to the #name_on_card property

  • :credit_card_type (String)

    The value to assign to the #credit_card_type property

  • :last_digits (String)

    The value to assign to the #last_digits property

  • :time_expiration (DateTime)

    The value to assign to the #time_expiration property



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 91

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['paymentMethod'] = 'OTHER'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.echeck_routing = attributes[:'echeckRouting'] if attributes[:'echeckRouting']

  raise 'You cannot provide both :echeckRouting and :echeck_routing' if attributes.key?(:'echeckRouting') && attributes.key?(:'echeck_routing')

  self.echeck_routing = attributes[:'echeck_routing'] if attributes[:'echeck_routing']

  self.name_on_card = attributes[:'nameOnCard'] if attributes[:'nameOnCard']

  raise 'You cannot provide both :nameOnCard and :name_on_card' if attributes.key?(:'nameOnCard') && attributes.key?(:'name_on_card')

  self.name_on_card = attributes[:'name_on_card'] if attributes[:'name_on_card']

  self.credit_card_type = attributes[:'creditCardType'] if attributes[:'creditCardType']

  raise 'You cannot provide both :creditCardType and :credit_card_type' if attributes.key?(:'creditCardType') && attributes.key?(:'credit_card_type')

  self.credit_card_type = attributes[:'credit_card_type'] if attributes[:'credit_card_type']

  self.last_digits = attributes[:'lastDigits'] if attributes[:'lastDigits']

  raise 'You cannot provide both :lastDigits and :last_digits' if attributes.key?(:'lastDigits') && attributes.key?(:'last_digits')

  self.last_digits = attributes[:'last_digits'] if attributes[:'last_digits']

  self.time_expiration = attributes[:'timeExpiration'] if attributes[:'timeExpiration']

  raise 'You cannot provide both :timeExpiration and :time_expiration' if attributes.key?(:'timeExpiration') && attributes.key?(:'time_expiration')

  self.time_expiration = attributes[:'time_expiration'] if attributes[:'time_expiration']
end

Instance Attribute Details

#credit_card_typeString

Echeck card type

Returns:

  • (String)


33
34
35
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 33

def credit_card_type
  @credit_card_type
end

#echeck_routingString

Last four routing digits of the card

Returns:

  • (String)


25
26
27
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 25

def echeck_routing
  @echeck_routing
end

#last_digitsString

Last four digits of the card

Returns:

  • (String)


37
38
39
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 37

def last_digits
  @last_digits
end

#name_on_cardString

Name on the echeck card

Returns:

  • (String)


29
30
31
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 29

def name_on_card
  @name_on_card
end

#time_expirationDateTime

Expired date of the echeck card

Returns:

  • (DateTime)


41
42
43
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 41

def time_expiration
  @time_expiration
end

Class Method Details

.attribute_mapObject

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



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 44

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'time_paid_on': :'timePaidOn',
    'paid_by': :'paidBy',
    'payment_method': :'paymentMethod',
    'amount_paid': :'amountPaid',
    'echeck_routing': :'echeckRouting',
    'name_on_card': :'nameOnCard',
    'credit_card_type': :'creditCardType',
    'last_digits': :'lastDigits',
    'time_expiration': :'timeExpiration'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 61

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'time_paid_on': :'DateTime',
    'paid_by': :'String',
    'payment_method': :'String',
    'amount_paid': :'Float',
    'echeck_routing': :'String',
    'name_on_card': :'String',
    'credit_card_type': :'String',
    'last_digits': :'String',
    'time_expiration': :'DateTime'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 152

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    time_paid_on == other.time_paid_on &&
    paid_by == other.paid_by &&
    payment_method == other.payment_method &&
    amount_paid == other.amount_paid &&
    echeck_routing == other.echeck_routing &&
    name_on_card == other.name_on_card &&
    credit_card_type == other.credit_card_type &&
    last_digits == other.last_digits &&
    time_expiration == other.time_expiration
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 190

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(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

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


170
171
172
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 170

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



179
180
181
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 179

def hash
  [time_paid_on, paid_by, payment_method, amount_paid, echeck_routing, name_on_card, credit_card_type, last_digits, time_expiration].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



223
224
225
226
227
228
229
230
231
232
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 223

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



217
218
219
# File 'lib/oci/osp_gateway/models/other_payment_detail.rb', line 217

def to_s
  to_hash.to_s
end