Class: VisaAcceptanceMergedSpec::PatchPaymentInstrumentRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb

Overview

PatchPaymentInstrumentRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(links: SKIP, id: SKIP, object: SKIP, default: SKIP, state: SKIP, type: SKIP, bank_account: SKIP, card: SKIP, buyer_information: SKIP, bill_to: SKIP, processing_information: SKIP, merchant_information: SKIP, instrument_identifier: SKIP, metadata: SKIP, embedded: SKIP, additional_properties: nil) ⇒ PatchPaymentInstrumentRequest

Returns a new instance of PatchPaymentInstrumentRequest.



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 147

def initialize(links: SKIP, id: SKIP, object: SKIP, default: SKIP,
               state: SKIP, type: SKIP, bank_account: SKIP, card: SKIP,
               buyer_information: SKIP, bill_to: SKIP,
               processing_information: SKIP, merchant_information: SKIP,
               instrument_identifier: SKIP, metadata: SKIP, embedded: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @links = links unless links == SKIP
  @id = id unless id == SKIP
  @object = object unless object == SKIP
  @default = default unless default == SKIP
  @state = state unless state == SKIP
  @type = type unless type == SKIP
  @bank_account =  unless  == SKIP
  @card = card unless card == SKIP
  @buyer_information = buyer_information unless buyer_information == SKIP
  @bill_to = bill_to unless bill_to == SKIP
  @processing_information = processing_information unless processing_information == SKIP
  @merchant_information = merchant_information unless merchant_information == SKIP
  @instrument_identifier = instrument_identifier unless instrument_identifier == SKIP
  @metadata =  unless  == SKIP
  @embedded = embedded unless embedded == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bank_accountBankAccount

The type of Payment Instrument. Possible Values:

  • cardHash

Returns:



50
51
52
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 50

def 
  @bank_account
end

#bill_toBillTo15

The type of Payment Instrument. Possible Values:

  • cardHash

Returns:



68
69
70
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 68

def bill_to
  @bill_to
end

#buyer_informationBuyerInformation13

The type of Payment Instrument. Possible Values:

  • cardHash

Returns:



62
63
64
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 62

def buyer_information
  @buyer_information
end

#cardCard12

The type of Payment Instrument. Possible Values:

  • cardHash

Returns:



56
57
58
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 56

def card
  @card
end

#defaultTrueClass | FalseClass

Flag that indicates whether customer payment instrument is the dafault. Possible Values:

  • true: Payment instrument is customer's default.
  • false: Payment instrument is not customer's default.

Returns:

  • (TrueClass | FalseClass)


31
32
33
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 31

def default
  @default
end

#embeddedEmbedded9

The type of Payment Instrument. Possible Values:

  • cardHash

Returns:



98
99
100
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 98

def embedded
  @embedded
end

#idString

The Id of the Payment Instrument Token.

Returns:

  • (String)


18
19
20
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 18

def id
  @id
end

#instrument_identifierInstrumentIdentifier10

The type of Payment Instrument. Possible Values:

  • cardHash


86
87
88
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 86

def instrument_identifier
  @instrument_identifier
end

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 14

def links
  @links
end

#merchant_informationMerchantInformation18

The type of Payment Instrument. Possible Values:

  • cardHash


80
81
82
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 80

def merchant_information
  @merchant_information
end

#metadataMetadata1

The type of Payment Instrument. Possible Values:

  • cardHash

Returns:



92
93
94
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 92

def 
  @metadata
end

#objectString

The type. Possible Values:

  • paymentInstrument

Returns:

  • (String)


24
25
26
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 24

def object
  @object
end

#processing_informationTmsPaymentInstrumentProcessingInfo

The type of Payment Instrument. Possible Values:

  • cardHash


74
75
76
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 74

def processing_information
  @processing_information
end

#stateString

Issuers state for the card number. Possible Values:

  • ACTIVE
  • CLOSED : The account has been closed.

Returns:

  • (String)


38
39
40
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 38

def state
  @state
end

#typeString

The type of Payment Instrument. Possible Values:

  • cardHash

Returns:

  • (String)


44
45
46
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 44

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 175

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  links = Links20.from_hash(hash['_links']) if hash['_links']
  id = hash.key?('id') ? hash['id'] : SKIP
  object = hash.key?('object') ? hash['object'] : SKIP
  default = hash.key?('default') ? hash['default'] : SKIP
  state = hash.key?('state') ? hash['state'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
   = BankAccount.from_hash(hash['bankAccount']) if hash['bankAccount']
  card = Card12.from_hash(hash['card']) if hash['card']
  buyer_information = BuyerInformation13.from_hash(hash['buyerInformation']) if
    hash['buyerInformation']
  bill_to = BillTo15.from_hash(hash['billTo']) if hash['billTo']
  if hash['processingInformation']
    processing_information = TmsPaymentInstrumentProcessingInfo.from_hash(hash['processingInformation'])
  end
  merchant_information = MerchantInformation18.from_hash(hash['merchantInformation']) if
    hash['merchantInformation']
  instrument_identifier = InstrumentIdentifier10.from_hash(hash['instrumentIdentifier']) if
    hash['instrumentIdentifier']
   = Metadata1.from_hash(hash['metadata']) if hash['metadata']
  embedded = Embedded9.from_hash(hash['_embedded']) if hash['_embedded']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  PatchPaymentInstrumentRequest.new(links: links,
                                    id: id,
                                    object: object,
                                    default: default,
                                    state: state,
                                    type: type,
                                    bank_account: ,
                                    card: card,
                                    buyer_information: buyer_information,
                                    bill_to: bill_to,
                                    processing_information: processing_information,
                                    merchant_information: merchant_information,
                                    instrument_identifier: instrument_identifier,
                                    metadata: ,
                                    embedded: embedded,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 101

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['links'] = '_links'
  @_hash['id'] = 'id'
  @_hash['object'] = 'object'
  @_hash['default'] = 'default'
  @_hash['state'] = 'state'
  @_hash['type'] = 'type'
  @_hash['bank_account'] = 'bankAccount'
  @_hash['card'] = 'card'
  @_hash['buyer_information'] = 'buyerInformation'
  @_hash['bill_to'] = 'billTo'
  @_hash['processing_information'] = 'processingInformation'
  @_hash['merchant_information'] = 'merchantInformation'
  @_hash['instrument_identifier'] = 'instrumentIdentifier'
  @_hash['metadata'] = 'metadata'
  @_hash['embedded'] = '_embedded'
  @_hash
end

.nullablesObject

An array for nullable fields



143
144
145
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 143

def self.nullables
  []
end

.optionalsObject

An array for optional fields



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 122

def self.optionals
  %w[
    links
    id
    object
    default
    state
    type
    bank_account
    card
    buyer_information
    bill_to
    processing_information
    merchant_information
    instrument_identifier
    metadata
    embedded
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



238
239
240
241
242
243
244
245
246
247
248
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 238

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} links: #{@links.inspect}, id: #{@id.inspect}, object: #{@object.inspect},"\
  " default: #{@default.inspect}, state: #{@state.inspect}, type: #{@type.inspect},"\
  " bank_account: #{@bank_account.inspect}, card: #{@card.inspect}, buyer_information:"\
  " #{@buyer_information.inspect}, bill_to: #{@bill_to.inspect}, processing_information:"\
  " #{@processing_information.inspect}, merchant_information:"\
  " #{@merchant_information.inspect}, instrument_identifier:"\
  " #{@instrument_identifier.inspect}, metadata: #{@metadata.inspect}, embedded:"\
  " #{@embedded.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



227
228
229
230
231
232
233
234
235
# File 'lib/visa_acceptance_merged_spec/models/patch_payment_instrument_request.rb', line 227

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} links: #{@links}, id: #{@id}, object: #{@object}, default: #{@default},"\
  " state: #{@state}, type: #{@type}, bank_account: #{@bank_account}, card: #{@card},"\
  " buyer_information: #{@buyer_information}, bill_to: #{@bill_to}, processing_information:"\
  " #{@processing_information}, merchant_information: #{@merchant_information},"\
  " instrument_identifier: #{@instrument_identifier}, metadata: #{@metadata}, embedded:"\
  " #{@embedded}, additional_properties: #{@additional_properties}>"
end