Class: OCI::OspGateway::Models::CreditCardPaymentOption

Inherits:
PaymentOption
  • Object
show all
Defined in:
lib/oci/osp_gateway/models/credit_card_payment_option.rb

Overview

Credit card 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 PaymentOption

PaymentOption::PAYMENT_METHOD_ENUM

Instance Attribute Summary collapse

Attributes inherited from PaymentOption

#payment_method, #wallet_instrument_id, #wallet_transaction_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PaymentOption

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ CreditCardPaymentOption

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :wallet_instrument_id (String)

    The value to assign to the #wallet_instrument_id proprety

  • :wallet_transaction_id (String)

    The value to assign to the #wallet_transaction_id proprety

  • :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

  • :name_on_card (String)

    The value to assign to the #name_on_card property

  • :time_expiration (DateTime)

    The value to assign to the #time_expiration property



82
83
84
85
86
87
88
89
90
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
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 82

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

  attributes['paymentMethod'] = 'CREDIT_CARD'

  super(attributes)

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

  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.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.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

Credit card type.

Returns:

  • (String)


26
27
28
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 26

def credit_card_type
  @credit_card_type
end

#last_digitsString

Last four digits of the card.

Returns:

  • (String)


30
31
32
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 30

def last_digits
  @last_digits
end

#name_on_cardString

Name on the credit card.

Returns:

  • (String)


34
35
36
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 34

def name_on_card
  @name_on_card
end

#time_expirationDateTime

Expired date of the credit card.

Returns:

  • (DateTime)


38
39
40
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 38

def time_expiration
  @time_expiration
end

Class Method Details

.attribute_mapObject

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



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 41

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'wallet_instrument_id': :'walletInstrumentId',
    'wallet_transaction_id': :'walletTransactionId',
    'payment_method': :'paymentMethod',
    'credit_card_type': :'creditCardType',
    'last_digits': :'lastDigits',
    'name_on_card': :'nameOnCard',
    'time_expiration': :'timeExpiration'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 56

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'wallet_instrument_id': :'String',
    'wallet_transaction_id': :'String',
    'payment_method': :'String',
    'credit_card_type': :'String',
    'last_digits': :'String',
    'name_on_card': :'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



137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 137

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

  self.class == other.class &&
    wallet_instrument_id == other.wallet_instrument_id &&
    wallet_transaction_id == other.wallet_transaction_id &&
    payment_method == other.payment_method &&
    credit_card_type == other.credit_card_type &&
    last_digits == other.last_digits &&
    name_on_card == other.name_on_card &&
    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



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 173

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


153
154
155
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 153

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



162
163
164
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 162

def hash
  [wallet_instrument_id, wallet_transaction_id, payment_method, credit_card_type, last_digits, name_on_card, time_expiration].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



206
207
208
209
210
211
212
213
214
215
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 206

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



200
201
202
# File 'lib/oci/osp_gateway/models/credit_card_payment_option.rb', line 200

def to_s
  to_hash.to_s
end